-
Notifications
You must be signed in to change notification settings - Fork 0
/
confirmpage.php
236 lines (230 loc) · 9.29 KB
/
confirmpage.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<?php
session_start();
$con = mysqli_connect("localhost","root","","emeal");
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Signika" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" media="screen" href="css/style.css" />
<script type="text/javascript" src="https://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5ab88174f9a49214"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
<script>
<?php if(isset($_SESSION['user'])&&!empty($_SESSION['user'])){?>
$(document).ready(function(){
$("#sign").hide();
$("#user").show();
});
<?php }?>
</script>
</head>
<body>
<div id="navigation">
<div id="title">
<div class="addthis_inline_share_toolbox_20fu"></div>
<p>e<span>MEAL</span></p>
<div id="sign">
<ul>
<li><a href="login.html">Sign in</a></li>
<li><a href="signup.php">Sign up</a></li>
</ul>
</div>
<div id="user">
<ul>
<li>Welcome, <a><?php echo $_SESSION['user']?></a>
<ul class="subnav2">
<li><a href="userProfile.php">Profile</a></li>
<li><a href="includes/logout.php">Log out</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="get_nav"></div>
<div id="shoppingcart">
<a href="shoppingcart.php">
<img src="img/713b83a7ab70e1a79d66d49efc33aff6.png">
<p>Shopping cart</p>
</a>
</div>
</div>
<div class="gray">
<div class="tabbar">
<ol class="breadcrumb">
<li><a href="shoppinggeneral.php">Shopping</a></li>
<li><a href="shoppingcart.php">Cart</a></li>
<li class="active">Information confirmation</li>
</ol>
</div>
<div class="detail-page">
<div id="confirm">
<div class="list_title">
<div class="row">
<div class="col-md-2"><p>Item</p></div>
<div class="col-md-4"><p>Name</p></div>
<div class="col-md-2"><p>Price</p></div>
<div class="col-md-2"><p>Quantity</p></div>
<div class="col-md-2"><p>Total</p>
</div>
</div>
</div>
<?php
$uid = $_SESSION['userId'];
$total = 0;
$retrievefromcart_query = "SELECT a.pId, b.productName, a.quantity, b.productPrice, b.productImage FROM cart a,product b WHERE a.pId = b.productId AND a.uId = '$uid'";
$totalprice_query = "SELECT SUM(a.quantity * b.productPrice) as Total_Price FROM cart a,product b WHERE a.pId = b.productId AND a.uId = '$uid'";
$retrieve_result = mysqli_query($con,$retrievefromcart_query);
$totalprice=mysqli_query($con,$totalprice_query);
if(mysqli_num_rows($totalprice) > 0){
while($total=mysqli_fetch_array($totalprice)){
$tnum=$total["Total_Price"];
}
}
if(mysqli_num_rows($retrieve_result) > 0) {
while ($cartrow = mysqli_fetch_array($retrieve_result)) {
?>
<div class="list_box">
<input class="getUID" type="hidden" value="<?php echo $uid?>">
<div class="row">
<div class="col-md-2">
<img src="productimage/<?php echo $cartrow["productImage"];?>" alt="Item img">
</div>
<div class="col-md-4">
<p class="item_name"><?php echo $cartrow['productName']; ?></p>
</div>
<div class="col-md-2"><p>$<?php echo $cartrow['productPrice']; ?></p>
</div>
<div class="col-md-2">
<p><?php echo $cartrow['quantity']; ?></p>
</div>
<div class="col-md-2">
<p>$<?php echo $cartrow['productPrice']*$cartrow['quantity'];?></p>
</div>
</div>
</div>
<?php
}
}?>
<div class="checkout">
<div class="check_price">
<p><span>Total price</span></p>
<div class="sign_price">
<p class="dollar_sign">$</p><p id="price_total"><?php echo $tnum?></p>
</div>
</div>
<div class="clearfloat"></div>
</div>
</div>
<div id="addressinfo">
<div id="getshipinfo"></div>
<?php
$shipquery = "SELECT * FROM user WHERE userId = '$uid'";
$result =mysqli_query($con, $shipquery);
if(mysqli_num_rows($result) > 0){
while($ship=mysqli_fetch_array($result)){
$name = $ship["userNickname"];
$address = $ship["userAddress"];
$postcode = $ship["userPostalcode"];
$cell = $ship["userContact"];
$email = $ship["userEmail"];
}}
?>
<div class="confirm_info">
<div class="row">
<div class="col-md-8">
<div class="row">
<div class="col-md-2 col-xs-6">
<p>Name</p>
</div>
<div class="col-md-7 col-xs-6">
<input class="name" type="text" value="<?php echo $name?>">
</div>
</div>
<div class="row">
<div class="col-md-2 col-xs-6">
<p>Address</p>
</div>
<div class="col-md-7 col-xs-6">
<input class="address" type="text" value="<?php echo $address?>">
</div>
</div>
<div class="row">
<div class="col-md-2 col-xs-6">
<p>Postcode</p>
</div>
<div class="col-md-7 col-xs-6">
<input class="postcode" type="text" value="<?php echo $postcode?>">
</div>
</div>
<div class="row">
<div class="col-md-2 col-xs-6">
<p>Cell Number</p>
</div>
<div class="col-md-7 col-xs-6">
<input class="phone" type="text" value="<?php echo $cell?>">
</div>
</div>
<div class="row">
<div class="col-md-2 col-xs-6">
<p>E-mail</p>
</div>
<div class="col-md-7 col-xs-6">
<input class="email" type="text" value="<?php echo $email?>">
</div>
<div class="col-md-3 col-xs-6">
<input type="button" class="confirm-btn" value="Confirm">
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="checkout">
<?php
echo '
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="emealoperator@gmail.com">
<input type="hidden" name="upload" value="1">';
$x=0;
$uid = $_SESSION["userId"];
$sql = "SELECT a.pId, b.productName, a.quantity, b.productPrice FROM cart a,product b WHERE a.pId = b.productId AND a.uId = '$uid';";
$query = mysqli_query($con,$sql);
while($row=mysqli_fetch_array($query)){
$x++;
echo
'<input type="hidden" name="item_name_'.$x.'" value="'.$row["productName"].'">
<input type="hidden" name="item_number_'.$x.'" value="'.$x.'">
<input type="hidden" name="amount_'.$x.'" value="'.$row["productPrice"].'">
<input type="hidden" name="quantity_'.$x.'" value="'.$row["quantity"].'">';
}
echo
'<input type="hidden" name="return" value="http://localhost/eMeal/payment_success.php"/>
<input type="hidden" name="notify_url" value="http://localhost/eMeal/payment_success.php">
<input type="hidden" name="cancel_return" value="http://localhost/eMeal/cancel.php"/>
<input type="hidden" name="currency_code" value="USD"/>
<input type="hidden" name="custom" value="'.$_SESSION["userId"].'"/>
<input style="float:right; width:220px; height:50px; margin-right:80px;" type="image" name="submit" class="checkout-btn"
src="https://www.paypalobjects.com/webstatic/en_US/i/btn/png/blue-rect-paypalcheckout-60px.png" alt="PayPal Checkout"
alt="PayPal - The safer, easier way to pay online">
</form>';
?>
</div>
</div>
<div class="clearfloat"></div>
</div>
</div>
<div class="clearfloat"></div>
</div>
<div id="footer">
<p>©2018 eMeal Company. All Rights Reserved</p>
</div>
</body>
</html>