-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorderMod.php
More file actions
38 lines (33 loc) · 1.21 KB
/
orderMod.php
File metadata and controls
38 lines (33 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
session_start();
if (!isset($_SESSION['memberid']) || !$_SESSION['isAdmin']) {
header('HTTP/1.0 403 Forbidden');
echo "<meta http-equiv='refresh' content='0;url=./login.php'>";
return;
}
else { //could have done ajax but nahh too ancient
require_once "conntodb.php";
$modType = $_GET['mod'];
$id = $_GET['id'];
switch ($modType) {
case 'del':
//do deletion function
$stmt = $link->prepare("DELETE FROM orders WHERE id = ?"); //delete from orders
$stmt->bind_param("i", $id);
$stmt->execute();
$stmt2 = $link->prepare("DELETE FROM order_detail WHERE order_id = ?"); //from orderdetails
$stmt2->bind_param("i", $id);
$stmt2->execute();
echo "<meta http-equiv='refresh' content='0;url=./admin.php'>";
break;
case 'upd':
//do update status
$status = $_GET['status'];
$stmt2 = $link->prepare("UPDATE orders SET saleStatus = ? WHERE id = ?"); //from orderdetails
$stmt2->bind_param("ii", $status, $id);
$stmt2->execute();
echo "<meta http-equiv='refresh' content='0;url=./admin.php'>";
break;
}
}
?>