source:
DeliverOrder.php
Last change on this file was e3d4e0a, checked in by , 6 days ago | |
---|---|
|
|
File size: 827 bytes |
Rev | Line | |
---|---|---|
[e3d4e0a] | 1 | <?php |
2 | ||
3 | session_start(); | |
4 | ||
5 | require './connect.php'; | |
6 | require './SendEmail.php'; | |
7 | ||
8 | if(!isset($_POST['order_id'])) { | |
9 | header("Location: ./ActiveOrders.php"); | |
10 | die(); | |
11 | } | |
12 | ||
13 | $res = mysqli_query($conn, "SELECT * FROM orders WHERE id={$_POST['order_id']};"); | |
14 | ||
15 | if(mysqli_num_rows($res) >= 1) { | |
16 | $row = $res->fetch_assoc(); | |
17 | ||
18 | if($row['status'] == 'a') { | |
19 | mysqli_query($conn, "UPDATE orders SET status = 'd', arrived_date = CURDATE() WHERE id={$_POST['order_id']};"); | |
20 | $email = mysqli_query($conn, "SELECT email FROM users WHERE user_id={$row['user_id']}")->fetch_assoc()['email']; | |
21 | SendMail($email, "InnovaDB Update\n", "Your order with id({$row['id']}) has been DELIVERED\n"); | |
22 | } | |
23 | } | |
24 | ||
25 | ||
26 | header("Location: ./ActiveOrders.php"); | |
27 | die(); | |
28 | ?> |
Note:
See TracBrowser
for help on using the repository browser.