-
Notifications
You must be signed in to change notification settings - Fork 0
/
processChannelOrders.php
47 lines (34 loc) · 1.29 KB
/
processChannelOrders.php
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
<?php
// must be numeric
if (isset($_POST) && !empty($_POST['cc_number']) && is_numeric($_POST['cc_number'])) {
require_once('useDatabase.php');
$cust_id = $_COOKIE['cust_id'];
$query = "SELECT * FROM ordertbl WHERE ord_in_cart_ordered = 'y' AND ord_cust_id = $cust_id";
$result = mysqli_query($dbc, $query);
if (mysqli_num_rows($result) >= 1) {
$query = "UPDATE ordertbl SET ord_in_cart_ordered = 'n' WHERE ord_cust_id = $cust_id";
$result = mysqli_query($dbc, $query)
or die('database error');
} else {
$msg = "Order has ALREADY been processed.";
}
} else {
$msg = "You did not enter your credit card number! Click the go back button and try again.";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Welcome to Shaw</title>
</head>
<body>
<h1 align="center">Shaw Channel</h1>
<h2 align="center">Orders so far for
<?php if (isset($_COOKIE['cust_fname']) && isset($_COOKIE['cust_lname']))
echo $_COOKIE['cust_fname'] . ' ' . $_COOKIE['cust_lname'];?>
</h2>
<p align="center"><strong><?php if(isset($msg)) echo $msg; ?></strong></p>
<p align="center"><strong><?php if(!isset($msg)) echo 'Thank you, '; ?>Please close your browser to exit </strong> <br/>
or <a href="channelLogout.php"><button type="button">Log out</button></a></p>
</body>
</html>