Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include("../includes/db.php");
- include("../functions/functions.php");
- include("../includes/header.php");
- if (isset($_GET['order_id']))
- {
- $order_id=$_GET['order_id'];
- }
- $invoice_check="select * from customer_orders WHERE order_id='$order_id'";
- $run_invoice_check=mysqli_query($con,$invoice_check);
- $run_invoice_row=mysqli_fetch_array($run_invoice_check);
- $database_invoice_number=$run_invoice_row['invoice_no'];
- $database_due_amount=$run_invoice_row['due_amount'];
- ?>
- <html>
- <head>
- </head>
- <body>
- <section>
- <div class="container">
- <div class="row">
- <div class="col-sm-3">
- <div class="left-sidebar">
- <h2>My Account</h2>
- <div class="panel-group category-products" id="accordian"><!--category-products start-->
- <div class="category-tab ul li ">
- <ul class="nav nav-pills nav-stacked" id="categories">
- <?php
- if(isset($_SESSION['customer_email']))
- {
- $user_session=$_SESSION['customer_email'];
- $get_customer_pic = "select * from customers where customer_email='$user_session'";
- $run_customer=mysqli_query($con,$get_customer_pic);
- $row_customer = mysqli_fetch_array($run_customer);
- $customer_pic=$row_customer['customer_image'];
- echo "<img src='customer_photos/$customer_pic' width='255' height='180'>";
- }
- ?>
- <li> <a href="my_account.php?my_orders">My Orders </a></li>
- <li> <a href="my_account.php?edit_account">Edit Account </a></li>
- <li> <a href="my_account.php?change_pass">Change Password </a></li>
- <li> <a href="my_account.php?delete_account">Delete Account </a></li>
- <li> <a href="../logout.php">Logout </a></li>
- <br>
- <br>
- <br>
- <br><br>
- <br><br>
- <br><br>
- <br>
- </ul>
- </div>
- </div><!--/category-products ends-->
- </div>
- </div>
- <div class="col-sm-9 padding-right">
- <?php
- if (isset($_GET['update_id']))
- {
- $order_id=$_GET['update_id'];
- }
- ?>
- <form enctype="multipart/form-data" action="confirm.php?update_id=<?php echo $order_id ?>" method="post">
- <?php
- if (isset($_GET['update_id']))
- {
- $order_id=$_GET['update_id'];
- }
- ?>
- <table width="500" align="center">
- <tr align="center">
- <td colspan="5" ><h2> Please confirm your payment</h2></td>
- </tr>
- <tr>
- <td>Invoice Number: </td>
- <td> <input type="text" name="invoice_no" class="form-control" value="<?php echo $database_invoice_number;?>" readonly required /> </td>
- </tr>
- <tr>
- <td>Amount: </td>
- <td> <input type="text" name="amount" class="form-control" value="<?php echo $database_due_amount;?>" readonly required /> </td>
- </tr>
- <tr>
- <td>Bank Number: </td>
- <td> <input type="text" class="form-control" required name="ref_no" /> </td>
- </tr>
- <tr>
- <td>Payment Date:</td>
- <td> <input type="date" class="form-control" required name="date" /> </td>
- </tr>
- <tr>
- <td>Payment Proofs:</td>
- <td> <input type="file" class="form-control" required name="proof" /> </td>
- </tr>
- <tr align="center">
- <td colspan="5"><br><input type="submit" class="btn btn-success" name="confirm" value="Confirm Payment"/> </td>
- </tr>
- </table>
- </form>
- </body>
- <html>
- </div>
- </div>
- </div>
- </section>
- <?php include("../includes/footer.php");?>
- <?php
- if(isset($_POST['confirm']))
- {
- $update_id=$_GET['update_id'];
- $invoice=$_POST['invoice_no'];
- $amount=$_POST['amount'];
- $payment_method="Bank Transfer";
- $ref_no=$_POST['ref_no'];
- $date=$_POST['date'];
- $proof = $_FILES['proof']['name'];
- $temp_proof = $_FILES['proof']['tmp_name'];
- $extension = pathinfo($_FILES['proof']['name'], PATHINFO_EXTENSION);
- $complete ="paid";
- //$update_id=
- $invoice_check="select * from customer_orders WHERE order_id='$order_id'";
- $run_invoice_check=mysqli_query($con,$invoice_check);
- $run_invoice_row=mysqli_fetch_array($run_invoice_check);
- $database_invoice_number=$run_invoice_row['invoice_no'];
- $path_proof = "payment_proof/$invoice.".$extension;
- if($database_invoice_number==$invoice)
- {
- move_uploaded_file($temp_proof,$path_proof);
- $insert_payment="INSERT into payments(invoice_no,amount,payment_mode,ref_no,payment_date,payment_proof) values('$invoice','$amount','$payment_method',
- '$ref_no','$date','$path_proof')";
- $run_payment=mysqli_query($con,$insert_payment);
- $update_order = "UPDATE customer_orders SET order_status='$complete' where order_id='$order_id'";
- $run_order=mysqli_query($con,$update_order);
- //$update_pending_order = "UPDATE pending_orders SET order_status='$complete' where invoice_no='$invoice'";
- //$run_pending_order=mysqli_query($con,$update_pending_order);
- if($run_payment)
- {
- echo "<script>alert('Thank you, Order will be processed within 24 hours!!')</script>";
- echo "<script>window.close()</script>";
- $update_pending_order = "UPDATE pending_orders SET order_status='$complete' where invoice_no='$invoice'";
- $run_pending_order=mysqli_query($con,$update_pending_order);
- }
- }
- else
- {
- echo "<script>alert('Invalid invoice number. Please check your invoice number by clicking MY ORDERS in your account')</script>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement