-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcheckout_success.php
154 lines (142 loc) · 4.85 KB
/
checkout_success.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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php
session_start();
if (!isset($_SESSION['cart'])){
$_SESSION['cart'] = array();
}
if (!isset($_SESSION['qty'])){
$_SESSION['qty']= array();
}
$deletecart = unserialize($_POST["delete"]);
$orderID = unserialize($_POST["orderID"]);
$custname = $_POST["custname"];
$custaddress = $_POST["custaddress"];
$custphone = $_POST["custphone"];
$custemail = $_POST["custemail"];
for($i=0;$i<count($deletecart);$i++){
$a = $deletecart[$i];
unset($_SESSION["cart"][$a]);
unset($_SESSION["qty"][$a]);
}
$sqlall = unserialize($_POST["sqlall"]);
$sqlorders = unserialize($_POST["sqlorders"]);
$servername = "localhost";
$username = "f31ee";
$password = "f31ee";
$dbname = "f31ee";
$print_success = TRUE;
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
echo "<script type='text/javascript'>alert('Connecting to database failed!');</script>";
die("Connection failed: " . mysqli_connect_error());
$print_success = FALSE;
}
for($i=0;$i<count($sqlorders);$i++){
$sql = $sqlorders[$i];
if ($result=mysqli_query($conn,$sql)) {
//echo "Insert sqlall success.";
} else{
echo "Error inserting sqlorders record!";
$print_success = FALSE;
}
}
for($i=0;$i<count($sqlall);$i++){
$sql = $sqlall[$i];
if ($result=mysqli_query($conn,$sql)) {
//echo "Insert sqlall success.";
} else{
echo "Error inserting sqlall record!";
$print_success = FALSE;
}
}
$sql = "INSERT INTO `customers` (orderID, name, address, phone, email) VALUES (".$orderID.", ". $custname . ", ". $custaddress .", ". $custphone .", ". $custemail .")";
if ($result=mysqli_query($conn,$sql)) {
//echo "Insert sqlall success.";
} else{
echo "Error inserting record!";
$print_success = FALSE;
}
//header("refresh:1; url=classic.php");
?>
<!doctype html>
<html lang="en">
<head>
<title>JHYJCakes Checkout Success</title>
<meta charset="utf-8">
<link rel="stylesheet" href="JHYJCSS.css">
<style>
#contenttitle {
margin-top: 30px;
margin-bottom: 50px;
text-align:left;
font-size: 200%;
color: #683e06;
border-bottom: 3px solid #683e06;
}
#desc {
font-size: 100%;
padding-bottom: 30px;
text-align: center;
color: #683e06;
}
.mid {
margin: auto;
height: 600px;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="top">
<header>
<div id="navigation">
<a href="index.html">
<img src="logo2.png" alt="Home" id="logo" style="width:300px;height:150px;border:0;">
</a>
<div class="tablenav">
<table align="right" id="navbar">
<tr>
<td colspan="2"></td>
<td align="right"><a href="cart.php" id="cart"><img src="cart.png" alt="Cart" style="width: 50px; height: 50px; border:0;"></a></td>
</tr>
<tr>
<td><div class="dropmenu" id="menu">
<b>MENU</b>
<div class="dropcontent">
<b><a href="classic.php">CLASSIC</a></b>
<b><a href="custom.php">CUSTOM</a></b>
</div>
</div></td>
<td><b><a href="track.html">TRACK ORDER</a></b></td>
<td><b><a href="about.html">ABOUT US</a></b></td>
</tr>
</table>
</div>
</div>
</header>
</div>
<div class="mid">
<div id="contenttitle">
<p><b>CHECKOUT SUCCESSFUL</b></p>
</div>
<div id="desc">
<p><b>Your Order Number is: <?php echo $orderID; ?></b></p>
<p>An email has been sent to you. <br> You may use this number to track your order progress.</p>
</div>
</div>
</div>
<div class="bot">
<footer>
<hr>
<br>
<div id="tm">
<small><i><b>Copyright © 2019 JHYJCakes</b></i></small>
</div>
<div id="links"><b>
<a href="about.html#left">CONTACT US</a>
<a href=""></a>
</b></div>
</footer>
</div>
</body>
</html>