Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.29 KB | None | 0 0
  1. <?php
  2. include 'inc/check_login.php';
  3. include 'connectiondb.php';
  4. $_SESSION['username'] = $_SESSION['manager']; // Must be already set
  5. ?>
  6. <?php
  7. $userid="";
  8. if (loggedin())
  9. {
  10. $query = mysql_query("SELECT * FROM account WHERE username='$_SESSION[manager]' AND description='admin' ");
  11. while ($row = mysql_fetch_assoc($query))
  12. {
  13. $username = $row ['username'];
  14. }
  15. }
  16. else
  17. {
  18. header("Location:login.php");
  19. exit();
  20. }
  21. ?>
  22. <?php include 'admin.php'?>
  23.  
  24. <tr>
  25. <td height="450" colspan="2" align="left" valign="top"><br />
  26. <table width="960" border="0">
  27. <tr>
  28. <td colspan="7" align="center" valign="middle">
  29.  
  30.  
  31.  
  32. <?php
  33. if (isset($_GET['updateid']))
  34. {
  35. $id = ($_GET['updateid']);
  36. echo 'Are you sure you want to accept return ID no : '.$id.' ? <a
  37. href="deliver.php?yesid='.$id.'">Yes!</a> |<a href="deliver.php"> No</a>!';
  38. }
  39. ?>
  40. <?php
  41. include 'connectiondb.php';
  42. if (isset($_GET['yesid']))
  43. {
  44. $trans_id = $_GET['yesid'];
  45. $status = $_GET['status'];
  46. $email = $_POST['receiver_email'];
  47.  
  48. $query = mysql_query("SELECT * FROM transactions WHERE 'id'='$trans_id'");
  49. while($row = mysql_fetch_assoc($query))
  50. {
  51. $db_status = $row['status'];
  52. $db_id = $_row['id'];
  53. $db_email = $row['receiver_email'];
  54. }
  55.  
  56. if($status == $db_status && $email == $db_email)
  57. {
  58. $sql=mysql_query("SELECT * FROM transactions WHERE id='$trans_id'");
  59. while($row = mysql_fetch_assoc($sql))
  60. {
  61. $email=$row['receiver_email'];
  62. }
  63. {
  64. $cnumber=$row['contact_number'];
  65. }
  66.  
  67. mysql_query("UPDATE `transactions` SET `status` = 'Complete' WHERE `transactions`.`id` = '$trans_id'");
  68. $message = "
  69. This is an automated message. Please do not reply.
  70.  
  71. You can now return the product by visiting our company
  72. just present your valid receipt
  73. thank you!";
  74. mail($email, "New Horizon Infinity Global Solutions Inc. Product Return",$message,"From: DoNotReply@nhi2014.com");
  75. $user = "itachi12";
  76. $password = "";
  77. $api_id = "1";
  78. $baseurl ="hm";
  79.  
  80. $text = urlencode("You can now return the product by visiting our company just present your valid receipt thank you! from http://nhiglobalsolutions.tk/");
  81. $to = "$cnumber";
  82.  
  83. // auth call
  84. $url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id";
  85.  
  86. // do auth call
  87. $ret = file($url);
  88.  
  89. // explode our response. return string is on first line of the data returned
  90. $sess = explode(":",$ret[0]);
  91. if ($sess[0] == "OK") {
  92.  
  93. $sess_id = trim($sess[1]); // remove any whitespace
  94. $url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text";
  95.  
  96. // do sendmsg call
  97. $ret = file($url);
  98. $send = explode(":",$ret[0]);
  99.  
  100. if ($send[0] == "ID") {
  101. echo "successnmessage ID: ". $send[1];
  102. } else {
  103. echo "send message failed invalid Contact No.";
  104. }
  105. } else {
  106. echo "Authentication failure: ". $ret[0];
  107. }
  108. echo '<div class="success">Successfully accepted the request <a href="transactions.php">click here to continue</a></div>';
  109. }
  110. else
  111. {
  112. echo '<div class="errormsgbox">"invalid"</div>';
  113. }
  114. }
  115. ?>
  116.  
  117. <?php
  118. if (isset($_GET['declineid']))
  119. {
  120. $id = ($_GET['declineid']);
  121. echo 'Are you sure you want to decline return ID no : '.$id.' ? <a
  122. href="transactions.php?noid='.$id.'">Yes!</a> |<a href="transactions.php"> No</a>!';
  123. }
  124. ?>
  125. <?php
  126. include 'connectiondb.php';
  127. if (isset($_GET['noid']))
  128. {
  129. $trans_id = $_GET['noid'];
  130. $status = $_GET['status'];
  131. $email = mysql_real_escape_string(strip_tags($_POST['email']));
  132.  
  133. $query = mysql_query("SELECT * FROM `return_product` WHERE 'id'='$trans_id'");
  134. while($row = mysql_fetch_assoc($query))
  135. {
  136. $db_status = $row['status'];
  137. $db_id = $_row['id'];
  138. }
  139.  
  140. if($status == $db_status)
  141. {
  142. $sql=mysql_query("SELECT * FROM transactions WHERE id='$trans_id'");
  143. while($row = mysql_fetch_assoc($sql))
  144. {
  145. $email=$row['email'];
  146. }
  147. {
  148. $cnumber=$row['contact_number'];
  149. }
  150. mysql_query("UPDATE `transactions` SET `status` = 'Declined' WHERE `transactions`.`id` = '$trans_id'");
  151. $message = "
  152. This is an automated message. Please do not reply.
  153.  
  154. Sorry your transaction could not be made
  155. please read the terms and conditions in returning a product.
  156. Thank You!
  157. ";
  158. mail($email, "New Horizon Infinity Global Solutions Inc. Product Return",$message,"From: DoNotReply@nhi2014.com");
  159. $user = "i12";
  160. $password = "N";
  161. $api_id = "3491351";
  162. $baseurl ="htm";
  163.  
  164. $text = urlencode("Sorry your transaction could not be made please read the terms and conditions in returning a product. Thank You! from http://nhiglobalsolutions.tk/");
  165. $to = "$cnumber";
  166.  
  167. // auth call
  168. $url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id";
  169.  
  170. // do auth call
  171. $ret = file($url);
  172.  
  173. // explode our response. return string is on first line of the data returned
  174. $sess = explode(":",$ret[0]);
  175. if ($sess[0] == "OK") {
  176.  
  177. $sess_id = trim($sess[1]); // remove any whitespace
  178. $url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text";
  179.  
  180. // do sendmsg call
  181. $ret = file($url);
  182. $send = explode(":",$ret[0]);
  183.  
  184. if ($send[0] == "ID") {
  185. echo "successnmessage ID: ". $send[1];
  186. } else {
  187. echo "send message failed invalid Contact No.";
  188. }
  189. } else {
  190. echo "Authentication failure: ". $ret[0];
  191. }
  192. echo '<div class="success">Successfully declined item <a href="transactions.php">click here to continue</a></div>';
  193. }
  194. else
  195. {
  196. echo '<div class="errormsgbox">"invalid"</div>';
  197. }
  198. }
  199. ?>
  200.  
  201. <?php
  202. include 'connectiondb.php';
  203. if (isset($_GET['id'])) {
  204. $targetID = $_GET['id'];
  205. $sql = mysql_query("SELECT * FROM products WHERE id='$targetID' LIMIT 1");
  206. $productCount = mysql_num_rows($sql); // count the output amount
  207. if ($productCount > 0) {
  208. while($row = mysql_fetch_array($sql)){
  209. $stock = $row["stock"];
  210. $date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));
  211. }
  212. } else {
  213. echo "<div id='error'>Invalid Id</div>";
  214. }
  215. }
  216. ?>
  217.  
  218. </td>
  219. </tr>
  220. <table width="960" border="0" align="center" style="background: 0 0 rgba(0, 0, 0, 0.14); box-shadow: 0 3px 1px rgba(0, 0, 0, 0.02) inset, 0 1px 0 white; -moz-border-radius: 15px; border-radius: 15px;">
  221.  
  222. <?php
  223. $sql1 = mysql_query("SELECT * FROM transactions");//database
  224. $returningcount = mysql_num_rows($sql1); // count the output amount
  225.  
  226. if ($returningcount > 0) {
  227. echo "<table width='960' border='0' align='center' style='background: 0 0 rgba(0, 0, 0, 0.14); box-shadow: 0 3px 1px rgba(0, 0, 0, 0.02) inset, 0 1px 0 white; -moz-border-radius: 15px; border-radius: 15px;'>";
  228. echo " <tr>
  229. <td colspan='2' align='center' valign='top'>
  230. <tr>
  231. <td width='89' align='center' valign='middle'><strong >Transaction ID</td>
  232. <td width='89' align='center' align='middle'><strong >No. of Ordered</td>
  233. <td width='89' align='center' valign='middle'><strong >Name</td>
  234. <td width='89' align='center' valign='middle'><strong >Payment Date</td>
  235. <td width='89' align='center' valign='middle'><strong >Txn id</td>
  236. <td width='89' align='center' valign='middle'><strong >Adress</td>
  237. <td width='89' align='center' valign='middle'><strong >Username</td>
  238. <td width='89' align='center' valign='middle'><strong >Status</td>
  239.  
  240.  
  241. </tr>";
  242. while($row = mysql_fetch_array($sql1)){
  243.  
  244. $userid = $row['id'];
  245. $array = $row['product_id_array'];
  246. $firstnames = $row['first_name'];
  247. $lastnames = $row['last_name'];
  248. $payment = $row['payment_date'];
  249. $txn = $row['txn_id'];
  250. $street = $row['address_street'];
  251. $city = $row['address_city'];
  252. $username = $row['username'];
  253. $status = $row['status'];
  254. echo'<tr>
  255. <td width="89" align="center" valign="middle" >'.$userid.'</td>
  256. <td width="89" align="center" valign="middle" >'.$array.'</td>
  257. <td width="450" align="center" valign="middle" >'.$firstnames.' '.$lastnames.'</td>
  258. <td width="89" align="center" valign="middle" >'.$payment.'</td>
  259. <td width="89" align="center" valign="middle" >'.$txn.'</td>
  260. <td width="89" align="center" valign="middle" >'.$street.' '.$city.'</td>
  261. <td width="89" align="center" valign="middle" >'.$username.'</td>
  262.  
  263.  
  264. <td width="89" align="center" valign="middle" style="color: GREEN;
  265. text-shadow: 0 1px 0 #FFFF00;
  266. font-size: 18px;
  267. font-family:serif">'.$status.'</td>
  268.  
  269. <td width="89"><a href="deliver.php?updateid='.$userid.'" style="font-family: verdana;border: 1px solid #1F79AE;
  270. background-color: #1F79AE;
  271. border-radius: 4px;
  272. box-shadow: inset 0 1px 3px #fff, inset 0 -15px #cbe6f2, 0 0 3px #8ec1da;
  273. -o-box-shadow: inset 0 1px 3px #fff, inset 0 -15px #cbe6f2, 0 0 3px #8ec1da;
  274. -webkit-box-shadow: inset 0 1px 3px #fff, inset 0 -15px #1F79AE, 0 0 3px #8ec1da;
  275. -moz-box-shadow: inset 0 1px 3px #fff, inset 0 -15px #cbe6f2, 0 0 3px #8ec1da;
  276. color: darkgreen;
  277. text-shadow: 0 1px #fff;
  278. padding: 2px 5px;">Accept</a><a
  279. href="deliver.php?declineid='.$userid.'" style="font-family: verdana;border: 1px solid #1F79AE;
  280. background-color: #1F79AE;
  281. border-radius: 4px;
  282. box-shadow: inset 0 1px 3px #fff, inset 0 -15px #cbe6f2, 0 0 3px #8ec1da;
  283. -o-box-shadow: inset 0 1px 3px #fff, inset 0 -15px #cbe6f2, 0 0 3px #8ec1da;
  284. -webkit-box-shadow: inset 0 1px 3px #fff, inset 0 -15px #1F79AE, 0 0 3px #8ec1da;
  285. -moz-box-shadow: inset 0 1px 3px #fff, inset 0 -15px #cbe6f2, 0 0 3px #8ec1da;
  286. color: darkgreen;
  287. text-shadow: 0 1px #fff;
  288. padding: 2px 5px;">Decline</a>
  289. </td></tr></tr>';
  290.  
  291. }
  292. }
  293.  
  294.  
  295. else{
  296. echo 'No Requesting';
  297. }
  298.  
  299. ?>
  300. </td>
  301.  
  302. </table>
  303.  
  304. </table>
  305.  
  306. </td>
  307. </tr>
  308. </table>
  309. <center>
  310. <br>
  311.  
  312. </tr>
  313. </center>
  314. </body>
  315. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement