-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcart.php
More file actions
200 lines (197 loc) · 9.52 KB
/
cart.php
File metadata and controls
200 lines (197 loc) · 9.52 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
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
<?php
include 'database/session.php';
require_once 'database/dbconnect.php';
if($login_session == 'guest')
header('Location:pleaselogin.php');
elseif ($login_session == 'admin') {
header("Location:index.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Console Wars</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/custom.css" rel="stylesheet">
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<style type="text/css">
@font-face { font-family: Anothershabby; src: url('fonts/Anothershabby.ttf'); }
@font-face { font-family: Hallosans; src: url('fonts/Hallosans.otf');}
@font-face { font-family: orangejuice; src: url('fonts/orangejuice.ttf'); }
@font-face { font-family: ZOMBIFIED; src: url('fonts/ZOMBIFIED.ttf'); }
@font-face { font-family: BlackWidow; src: url('fonts/BlackWidow.ttf'); }
@font-face { font-family: Blazed; src: url('fonts/Blazed.ttf'); }
</style>
<script src="js/login-register.js" type="text/javascript"></script>
</head>
</head>
<!-- *********************************************************************************************** -->
<body>
<div class="navbar-wrapper">
<div class="container">
<div class="navbar navbar navbar-static-top">
<div class="navbar-header">
<a class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="navbar-brand" href="index.php">CONWARS<sup>®</sup></a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Consoles <b class="caret"></b></a>
<ul class="dropdown-menu" role="menu">
<?php
if($login_session == "guest"){
echo '<li><a href="pleaselogin.php">PS3</a></li>';
} else{
echo '<li><a href="database/ps3.php">PS3</a></li>';
}
echo '<li class="divider"></li>';
if($login_session == "guest"){
echo '<li><a href="pleaselogin.php">PS4</a></li>';
} else{
echo '<li><a href="database/ps4.php">PS4</a></li>';
}
echo '<li class="divider"></li>';
if($login_session == "guest"){
echo '<li><a href="pleaselogin.php">X-BOX 360</a></li>';
} else{
echo '<li><a href="database/xbox.php">X-BOX 360</a></li>';
}
echo '<li class="divider"></li>';
if($login_session == "guest"){
echo '<li><a href="pleaselogin.php">X-BOX ONE</a></li>';
} else{
echo '<li><a href="database/xbox1.php">X-BOX ONE</a></li>';
}
?>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right" style="padding-right:120px;">
<li ><a href="database/logout.php" data-toggle="modal">Logout</a></li>
</ul>
</div>
</div>
</div>
</div>
<div align="center" id="mainWrapper" style="padding-top:40px;">
<div class="page-header">
<h1 style="color: #000000;font-size:30px;font-weight:bold; font-family: Anothershabby">Cart</h1>
</div>
</div>
<?php
$total=0;
$query=mysql_query('select * from cart where user_id='.$_SESSION['user_id'].' GROUP BY game,console');
echo '<div class="container" style="padding-top:40px">
<div class="row">
<div class="col-sm-12 col-md-10 col-md-offset-1">';
$count=mysql_num_rows($query);
if($count < 1){
echo '<center>
<h1> CART EMPTY </h1><br><br><br>
<a class="btn btn-info" href="index.php">CONTINUE SHOPPING</a>
</center>';
} else {
echo '<table class="table table-hover">
<thead>
<tr>
<th>Product</th>
<td> </td>
<th class="text-center">Price</th>
<th> </th>
</tr>
</thead>
<tbody>';
while($row=mysql_fetch_array($query)){
$query2= mysql_query('select count(*) from cart where game="'.$row[1].'" and console="'.$row[4].'" and user_id='.$row[3]);
$row2=mysql_fetch_row($query2);
$total=$total+($row2[0]*$row[2]);
echo '<tr>
<td class="col-sm-8 col-md-6">
<div class="media">';
if ($row[4] == 'PLAYSTATION 3'){
echo '<a class="thumbnail pull-left" href="#"> <img class="media-object" src="img/ps3.jpg" style="width: 72px; height: 72px;"> </a>';
}
else if ($row[4] == 'PLAYSTATION 4'){
echo '<a class="thumbnail pull-left" href="#"> <img class="media-object" src="img/ps4.jpg" style="width: 72px; height: 72px;"> </a>';
}
else if ($row[4] == 'XBOX 360'){
echo '<a class="thumbnail pull-left" href="#"> <img class="media-object" src="img/xbox360.jpg" style="width: 72px; height: 72px;"> </a>';
}
else if ($row[4] == 'XBOX ONE'){
echo '<a class="thumbnail pull-left" href="#"> <img class="media-object" src="img/x1.jpg" style="width: 72px; height: 72px;"> </a>';
}
echo ' <div class="media-body">
<h4 class="media-heading" style="padding-left:20px;padding-top:30px">'.$row[1].'</h4>
<h5 class="media-heading" style="padding-left:20px;"> Console : '.$row[4].'</h5>
<h5 class="media-heading" style="padding-left:20px;"> Quantity : '.$row2[0].'</h5>
</div>
</div></td>
<td> </td>
<td class="col-sm-1 col-md-1 text-center" style="padding-top:35px"><strong><i class="fa fa-rupee">'.$row[2].'</strong></td>
<td> </td>
<td class="col-sm-1 col-md-1" style="padding-top:30px" >
<a class="btn btn-warning" href="database/user_cart.php?game_id='.$row[0].'">Remove</a>
<!-- <button type="button" class="btn btn-danger pull-right">
<span class="glyphicon glyphicon-remove"></span> Remove
</button> -->
</td>
</tr>';
}
echo '<!-- <tr>
<td> </td>
<td> </td>
<td> </td>
<td><h5>Subtotal</h5></td>
<td class="text-right"><h5><strong><i class="fa fa-rupee">24.59</strong></h5></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><h5>Estimated shipping</h5></td>
<td class="text-right"><h5><strong><i class="fa fa-rupee">6.94</strong></h5></td>
</tr> -->
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><h3>Total</h3></td>
<td class="text-right"><h3><strong><i class="fa fa-rupee">'.$total.'</strong></h3></td>
</tr>
<tr>
<td> <a class="btn btn-danger" href="database/user_cart.php?game_id=-1">Empty Cart</a> </td>
<td> </td>
<td> </td>
<td>
<a class="btn btn-info" href="index.php">Continue Shopping</a>
<!-- button type="button" class="btn btn-default" action="../index.php">
<span class="glyphicon glyphicon-shopping-cart"></span> Continue Shopping
</button> -->
</td>
<td>
<a class="btn btn-success" href="">Checkout</a>
<!-- <button type="button" class="btn btn-success">
Checkout <span class="glyphicon glyphicon-play"></span>
</button> -->
</td>
</tr>';
}
echo '</tbody>
</table>
</div>
</div>
</div>';
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>