source: DiscardOrder.php

Last change on this file was e3d4e0a, checked in by Vlado 222039 <vlado.popovski@…>, 6 days ago

Upload project files

  • Property mode set to 100644
File size: 742 bytes
RevLine 
[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: ./PendingOrders.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 mysqli_query($conn, "UPDATE orders SET status = 'x' WHERE id={$_POST['order_id']}");
18 $email = mysqli_query($conn, "SELECT email FROM users WHERE user_id={$row['user_id']}")->fetch_assoc()['email'];
19 SendMail($email, "InnovaDB Update\n", "Your order with id({$row['id']}) has been DISCARDED\n");
20 }
21
22 header("Location: ./PendingOrders.php");
23 die();
24?>
Note: See TracBrowser for help on using the repository browser.