Advertisement
vdp

Untitled

vdp
Jul 31st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.49 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include("../includes/db.php");
  4. include("../functions/functions.php");
  5. include("../includes/header.php");
  6.  
  7. if (isset($_GET['order_id']))
  8. {
  9.     $order_id=$_GET['order_id'];
  10. }
  11. $invoice_check="select * from customer_orders WHERE order_id='$order_id'";
  12. $run_invoice_check=mysqli_query($con,$invoice_check);
  13. $run_invoice_row=mysqli_fetch_array($run_invoice_check);
  14. $database_invoice_number=$run_invoice_row['invoice_no'];
  15. $database_due_amount=$run_invoice_row['due_amount'];
  16. ?>
  17. <html>
  18.  
  19. <head>
  20. </head>
  21.  
  22. <body>
  23.     <section>
  24.         <div class="container">
  25.             <div class="row">
  26.                 <div class="col-sm-3">
  27.                     <div class="left-sidebar">
  28.                         <h2>My Account</h2>
  29.                         <div class="panel-group category-products" id="accordian"><!--category-products start-->
  30.                             <div class="category-tab ul li ">
  31.                                 <ul class="nav nav-pills nav-stacked" id="categories">
  32.                                     <?php
  33.                                     if(isset($_SESSION['customer_email']))
  34.                                     {
  35.                                         $user_session=$_SESSION['customer_email'];
  36.                                         $get_customer_pic = "select * from customers where customer_email='$user_session'";
  37.                                         $run_customer=mysqli_query($con,$get_customer_pic);
  38.                                         $row_customer = mysqli_fetch_array($run_customer);
  39.                                         $customer_pic=$row_customer['customer_image'];
  40.  
  41.                                         echo "<img src='customer_photos/$customer_pic' width='255' height='180'>";
  42.  
  43.                                     }
  44.  
  45.  
  46.                                     ?>
  47.                                     <li> <a href="my_account.php?my_orders">My Orders </a></li>
  48.                                     <li> <a href="my_account.php?edit_account">Edit Account </a></li>
  49.                                     <li> <a href="my_account.php?change_pass">Change Password </a></li>
  50.                                     <li> <a href="my_account.php?delete_account">Delete Account </a></li>
  51.                                     <li> <a href="../logout.php">Logout </a></li>
  52.                                     <br>
  53.                                     <br>
  54.                                     <br>
  55.                                     <br><br>
  56.                                     <br><br>
  57.                                     <br><br>
  58.                                     <br>
  59.                                 </ul>
  60.                             </div>
  61.  
  62.                         </div><!--/category-products ends-->
  63.  
  64.  
  65.  
  66.  
  67.                     </div>
  68.                 </div>
  69.  
  70.                 <div class="col-sm-9 padding-right">
  71.                     <?php
  72.                     if (isset($_GET['update_id']))
  73.                     {
  74.                         $order_id=$_GET['update_id'];
  75.                     }
  76.  
  77.  
  78.                     ?>
  79.                     <form enctype="multipart/form-data" action="confirm.php?update_id=<?php echo $order_id ?>" method="post">
  80.  
  81.                         <?php
  82.                         if (isset($_GET['update_id']))
  83.                         {
  84.                             $order_id=$_GET['update_id'];
  85.                         }
  86.  
  87.  
  88.                         ?>
  89.                         <table width="500" align="center">
  90.                             <tr align="center">
  91.                                 <td colspan="5" ><h2> Please confirm your payment</h2></td>
  92.                             </tr>
  93.  
  94.                             <tr>
  95.                                 <td>Invoice Number: </td>
  96.                                 <td> <input type="text" name="invoice_no" class="form-control" value="<?php echo $database_invoice_number;?>" readonly  required  /> </td>
  97.                             </tr>
  98.  
  99.                             <tr>
  100.                                 <td>Amount: </td>
  101.                                 <td> <input type="text" name="amount" class="form-control" value="<?php echo $database_due_amount;?>" readonly required  /> </td>
  102.                             </tr>
  103.                         <tr>
  104.                             <td>Bank Number: </td>
  105.                             <td> <input type="text" class="form-control" required name="ref_no" /> </td>
  106.                         </tr>
  107.                         <tr>
  108.                             <td>Payment Date:</td>
  109.                             <td> <input type="date" class="form-control" required name="date" /> </td>
  110.                         </tr>
  111.                         <tr>
  112.                             <td>Payment Proofs:</td>
  113.                             <td> <input type="file" class="form-control" required name="proof" /> </td>
  114.                         </tr>
  115.  
  116.  
  117.  
  118.                         <tr align="center">
  119.                             <td colspan="5"><br><input type="submit" class="btn btn-success" name="confirm" value="Confirm Payment"/> </td>
  120.                         </tr>
  121.                     </table>
  122.  
  123.                 </form>
  124.             </body>
  125.             <html>
  126.         </div>
  127.     </div>
  128. </div>
  129. </section>
  130. <?php include("../includes/footer.php");?>
  131. <?php
  132. if(isset($_POST['confirm']))
  133. {
  134.     $update_id=$_GET['update_id'];
  135.     $invoice=$_POST['invoice_no'];
  136.     $amount=$_POST['amount'];
  137.     $payment_method="Bank Transfer";
  138.     $ref_no=$_POST['ref_no'];
  139.     $date=$_POST['date'];
  140.     $proof = $_FILES['proof']['name'];
  141.     $temp_proof = $_FILES['proof']['tmp_name'];
  142.     $extension = pathinfo($_FILES['proof']['name'], PATHINFO_EXTENSION);
  143.     $complete ="paid";
  144.     //$update_id=
  145.  
  146.  
  147.     $invoice_check="select * from customer_orders WHERE order_id='$order_id'";
  148.     $run_invoice_check=mysqli_query($con,$invoice_check);
  149.     $run_invoice_row=mysqli_fetch_array($run_invoice_check);
  150.     $database_invoice_number=$run_invoice_row['invoice_no'];
  151.  
  152.     $path_proof = "payment_proof/$invoice.".$extension;
  153.  
  154.     if($database_invoice_number==$invoice)
  155.     {
  156.         move_uploaded_file($temp_proof,$path_proof);
  157.         $insert_payment="INSERT into payments(invoice_no,amount,payment_mode,ref_no,payment_date,payment_proof) values('$invoice','$amount','$payment_method',
  158.         '$ref_no','$date','$path_proof')";
  159.  
  160.         $run_payment=mysqli_query($con,$insert_payment);
  161.  
  162.  
  163.  
  164.  
  165.         $update_order = "UPDATE customer_orders SET order_status='$complete' where order_id='$order_id'";
  166.  
  167.         $run_order=mysqli_query($con,$update_order);
  168.  
  169.  
  170.         //$update_pending_order = "UPDATE pending_orders SET order_status='$complete' where invoice_no='$invoice'";
  171.         //$run_pending_order=mysqli_query($con,$update_pending_order);
  172.  
  173.  
  174.  
  175.  
  176.  
  177.         if($run_payment)
  178.         {
  179.             echo "<script>alert('Thank you, Order will be processed within 24 hours!!')</script>";
  180.             echo "<script>window.close()</script>";
  181.  
  182.             $update_pending_order = "UPDATE pending_orders SET order_status='$complete' where invoice_no='$invoice'";
  183.             $run_pending_order=mysqli_query($con,$update_pending_order);
  184.  
  185.  
  186.         }
  187.     }
  188.  
  189.     else
  190.     {
  191.         echo "<script>alert('Invalid invoice number. Please check your invoice number by clicking MY ORDERS in your account')</script>";
  192.     }
  193.  
  194.  
  195.  
  196.  
  197. }
  198.  
  199. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement