PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/Rev_report.php

https://bitbucket.org/bsaisandeep/social-networking-site
PHP | 217 lines | 155 code | 62 blank | 0 comment | 28 complexity | 6e7b47022dd95b1fb0ab992507aafa2d MD5 | raw file
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  3. <title> SBU network </title>
  4. <link rel="stylesheet" href="./Wordpress Theme TW_files/style.css" type="text/css" media="screen">
  5. <link rel="stylesheet" id="wp-polls-css" href="./Wordpress Theme TW_files/polls-css.css" type="text/css" media="all">
  6. <link rel="stylesheet" id="wp-pagenavi-css" href="./Wordpress Theme TW_files/pagenavi-css.css" type="text/css" media="all">
  7. </head>
  8. <body class="home blog">
  9. <!-- wrapper_top -->
  10. <div class="wrapper_top">
  11. <!-- wrapper -->
  12. <div class="wrapper">
  13. <div id="header">
  14. <!-- mainmenu -->
  15. <div id="mainmenu">
  16. <ul>
  17. <li class="page_item page-item-4"><a href="Welcome.php"><span>Home</span></a></li>
  18. <li class="page_item page-item-4"><a href="MyProfile.php" title="About"><span>Profile</span></a></li>
  19. <li class="page_item page-item-4"><a href="Friends.php"><span>Friends</span></a></li>
  20. <li class="page_item page-item-6"><a href="upload.php" title="Links"><span>Photos</span></a></li>
  21. <li class="page_item page-item-4"><a href="LoginPage.php" title="Logout"><span>Logout</span></a>
  22. </div>
  23. <!-- /mainmenu -->
  24. <!-- sidebar_search -->
  25. <div id="sidebar_search">
  26. <form action="SearchFriends.php" method="get">
  27. <fieldset>
  28. <label for="main_search_val">Search</label>
  29. <input type="text" value="" name="s" id="main_search_val">
  30. <input type="image" src="./Wordpress Theme TW_files/button_search.gif" alt="search" id="main_search_sub">
  31. </fieldset>
  32. </form>
  33. </div>
  34. <!-- /sidebar_search -->
  35. </div>
  36. <img src="./Penguins.jpg" alt="Big Boat" width="760" height="228"/>
  37. <br><br>
  38. <!-- /header -->
  39. <!-- board -->
  40. <!-- navigation -->
  41. <div id="board1"> <p> About Me </p></div>
  42. <br><br>
  43. <div id="board">
  44. <p>
  45. <?php
  46. $con = mysql_connect("localhost","root","sandeep");
  47. if (!$con)
  48. {
  49. die('Could not connect: ' . mysql_error());
  50. }
  51. mysql_select_db("my_db", $con);
  52. $id=$_COOKIE["user"];
  53. $srch=$_GET['searchby'];
  54. if ($_GET['searchtype'] == 1)
  55. {
  56. echo "user " . $srch ."<br>";
  57. $result = mysql_query("Select SUM(revenue) as Sum from Transactions where LoginID = '$srch' ");
  58. $row = mysql_fetch_array($result);
  59. echo "<br><br>Generated Revenue of:". $row['Sum'];
  60. }
  61. else if ($_GET['searchtype'] == 2)
  62. {
  63. $sum=0;
  64. echo "Item " . $srch ."<br>";
  65. $result = mysql_query(" Select * from Ads where Item = '$srch'");
  66. while($row = mysql_fetch_array($result))
  67. {
  68. $srch = $row['AdID'];
  69. $result1 = mysql_query(" Select SUM(revenue) as Sum from Transactions where AdID = '$srch' ");
  70. $row1 = mysql_fetch_array($result1);
  71. $sum=$sum+$row1['Sum'];
  72. }
  73. echo " Generated revenue of " . $sum;
  74. }
  75. else if ($_GET['searchtype'] == 3)
  76. {
  77. $sum=0;
  78. echo "Company " . $srch ."<br>";
  79. $result = mysql_query(" Select * from Ads where Company = '$srch'");
  80. while($row = mysql_fetch_array($result))
  81. {
  82. $srch = $row['AdID'];
  83. $result1 = mysql_query(" Select SUM(revenue) as Sum from Transactions where AdID = '$srch' ");
  84. $row1 = mysql_fetch_array($result1);
  85. $sum=$sum+$row1['Sum'];
  86. }
  87. echo " Generated revenue of " . $sum;
  88. }
  89. else if ($_GET['searchtype'] == 4)
  90. {
  91. echo "Transactions of " . $srch ."<br>";
  92. $result = mysql_query(" Select * from Transactions where LoginID = '$srch'");
  93. echo " AdID &nbsp&nbsp&nbsp&nbsp&nbsp noOfUnits &nbsp&nbsp&nbsp&nbsp&nbsp Date <br>";
  94. while($row = mysql_fetch_array($result))
  95. {
  96. echo $row['AdID'] ." &nbsp &nbsp &nbsp&nbsp &nbsp &nbsp&nbsp &nbsp &nbsp" . $row['noOfUnits'] ." &nbsp &nbsp &nbsp &nbsp &nbsp&nbsp" . $row['Date'] . "<br>";
  97. }
  98. }
  99. else if ($_GET['searchtype'] == 5)
  100. {
  101. echo "Transactions of " . $srch ."<br>";
  102. $result = mysql_query(" Select * from Transactions where AdID IN (Select AdID from Ads where Item like '$srch')");
  103. echo " AdID &nbsp&nbsp&nbsp&nbsp&nbsp noOfUnits &nbsp&nbsp&nbsp&nbsp&nbsp Date <br>";
  104. while($row = mysql_fetch_array($result))
  105. {
  106. echo $row['AdID'] ." &nbsp &nbsp &nbsp&nbsp &nbsp &nbsp&nbsp &nbsp &nbsp" . $row['noOfUnits'] ." &nbsp &nbsp &nbsp &nbsp &nbsp&nbsp" . $row['Date'] . "<br>";
  107. }
  108. }
  109. else if ($_GET['searchtype'] == 6)
  110. {
  111. echo "Customers who bought " . $srch ."<br><br>";
  112. $result = mysql_query(" Select Distinct(LoginID) from Transactions where AdID IN (Select AdID from Ads where Item like '$srch')");
  113. echo " LoginID <br>";
  114. while($row = mysql_fetch_array($result))
  115. {
  116. echo $row['LoginID'];
  117. }
  118. }
  119. else if ($_GET['searchtype'] == 7)
  120. {
  121. echo "Transactions of " . $srch ."<br>";
  122. $result = mysql_query(" SELECT AdID,SUM(noOfUnits) As sum from Transactions T Where T.AdID in (Select AdID from Ads where Company='$srch') group by AdID order by sum ");
  123. echo " AdID &nbsp&nbsp&nbsp&nbsp&nbsp noOfUnits &nbsp&nbsp&nbsp&nbsp&nbsp <br>";
  124. while($row = mysql_fetch_array($result))
  125. {
  126. echo $row['AdID'] ." &nbsp &nbsp &nbsp&nbsp &nbsp &nbsp&nbsp &nbsp &nbsp" . $row['sum'] . "<br>";
  127. }
  128. }
  129. else if ($_GET['searchtype'] == 8)
  130. {
  131. echo "Customers who bought " . $srch ."<br><br>";
  132. $result = mysql_query(" Select TransID, AdID, T.LoginId,Address,City,State,Zipcode,Phone from Transactions T, Registration R where T.LoginID=R.LoginId and AdID IN (Select AdID from Ads where item like '$srch')");
  133. echo " TransID &nbsp AdID &nbsp&nbsp &nbsp &nbsp &nbsp LoginID &nbsp&nbsp &nbsp &nbsp&nbsp &nbsp &nbsp Address &nbsp&nbsp &nbsp &nbsp&nbsp &nbsp &nbsp City &nbsp&nbsp &nbsp &nbsp&nbsp &nbsp &nbsp State &nbsp&nbsp &nbsp &nbsp&nbsp &nbsp &nbsp Zipcode &nbsp&nbsp &nbsp &nbsp&nbsp &nbsp &nbsp Phone<br>";
  134. while($row = mysql_fetch_array($result))
  135. {
  136. echo $row['TransID'] . "&nbsp &nbsp &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp" .$row['AdID'] ." &nbsp &nbsp &nbsp&nbsp &nbsp &nbsp" . $row['LoginId'] ." &nbsp &nbsp &nbsp &nbsp &nbsp&nbsp" . $row['Address'] . " &nbsp &nbsp &nbsp &nbsp &nbsp&nbsp" . $row['City'] ." &nbsp &nbsp &nbsp &nbsp &nbsp&nbsp" . $row['State'] ." &nbsp &nbsp &nbsp &nbsp &nbsp&nbsp" . $row['Zipcode'] ." &nbsp &nbsp &nbsp &nbsp &nbsp&nbsp" . $row['Phone'] . "<br>";
  137. }
  138. }
  139. else if ($_GET['searchtype'] == 9)
  140. {
  141. echo "Suggested Items for " . $srch ."<br><br>";
  142. $result = mysql_query(" Select AdID, Item,Company FROM Ads where item IN (SELECT Distinct(item) FROM Ads A, Transactions T WHERE A.AdID=T.AdID and T.LoginID='$srch')");
  143. while($row = mysql_fetch_array($result))
  144. {
  145. echo $row['AdID'] . "&nbsp &nbsp &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp" .$row['Item'] ." &nbsp &nbsp &nbsp&nbsp &nbsp &nbsp" . $row['Company'] . "<br>";
  146. }
  147. }
  148. else
  149. {
  150. echo "company and item";
  151. }
  152. ?>
  153. </p>
  154. </div>
  155. </body></html>