-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadminorders.php
More file actions
83 lines (68 loc) · 2.53 KB
/
Copy pathadminorders.php
File metadata and controls
83 lines (68 loc) · 2.53 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
session_start();
require("config.php");
require("db.php");
require("functions.php");
// Check if administrator is logged in
if(!isset($_SESSION['SESS_ADMINLOGGEDIN'])) {
header("Location: " . $config_basedir);
exit;
}
// Check if 'func' GET parameter exists
if(isset($_GET['func'])) {
if($_GET['func'] != "conf") {
header("Location: " . $config_basedir);
exit;
}
// Validate the id
$validid = pf_validate_number($_GET['id'], "redirect", $config_basedir);
// Update order status using prepared statement
$funcsql = "UPDATE orders SET status = 10 WHERE id = ?";
$stmt = mysqli_prepare($db, $funcsql);
mysqli_stmt_bind_param($stmt, "i", $_GET['id']);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
header("Location: " . $config_basedir . "adminorders.php");
exit;
}
else {
require("header.php");
echo "<h1>Outstanding orders</h1>";
echo "<a href='adminhome.php'><--- Return to the administrative panel</a>";
$orderssql = "SELECT * FROM orders WHERE status = 2";
$ordersres = mysqli_query($db, $orderssql);
$numrows = mysqli_num_rows($ordersres);
if($numrows == 0) {
echo "<p><strong>There are no orders currently.</strong>";
}
else {
echo "<table cellspacing=10>";
while($row = mysqli_fetch_assoc($ordersres)) {
echo "<tr>";
echo "<td>[<a href='adminorderdetails.php?id=" . htmlspecialchars($row['id']) . "'>View</a>]</td>";
echo "<td>" . date("D jS F Y g.iA", strtotime($row['date'])) . "</td>";
echo "<td>";
if($row['registered'] == 1) {
echo "Registered Customer";
}
else {
echo "Non-Registered Customer";
}
echo "</td>";
echo "<td>£" . sprintf('%.2f', $row['total']) . "</td>";
echo "<td>";
if($row['payment_type'] == 1) {
echo "PayPal";
}
else {
echo "Cheque";
}
echo "</td>";
echo "<td><a href='adminorders.php?func=conf&id=" . htmlspecialchars($row['id']) . "'>Confirm Payment</a></td>";
echo "</tr>";
}
echo "</table>";
}
}
require("footer.php");
?>