-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAuto.php
More file actions
230 lines (154 loc) · 6.12 KB
/
Auto.php
File metadata and controls
230 lines (154 loc) · 6.12 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
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
<?php
// Initialize the session
session_start();
$con=mysqli_connect("localhost","root","","honestcraig_db");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<style type="text/css">
.tg {border-collapse:collapse;border-spacing:0;border-color:#999;margin:0px auto;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 20px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#999;color:#444;background-color:#F7FDFA;}
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 20px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#999;color:#fff;background-color:#990000;}
.tg .tg-baqh{text-align:center;vertical-align:center}
.tg .tg-cx4s{background-color:#f7fdfa;text-align:center;vertical-align:center}
.tg .tg-yw4l{vertical-align:top}
@media screen and (max-width: 767px) {.tg {width: auto !important;}.tg col {width: auto !important;}.tg-wrap {overflow-x: auto;-webkit-overflow-scrolling: touch;margin: auto 0px;}}</style>
<title>HonestCraig</title>
<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="stylesheet.css" type="text/css" rel="stylesheet">
</head>
<body style="background-color: #990000">
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark static-top">
<div class="container">
<a class="navbar-brand" href="#"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item ">
<a class="nav-link" href="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="account.php">Account</a>
</li>
<li class="nav-item">
<a class="nav-link" href="sell.php">Sell</a>
</li>
</ul>
</div>
</div>
</nav>
<br>
<div class="row" style="background-color: #990000">
<br>
<div class="col-4"></div>
<div class="col-4"style="background-color: #b9bec1">
<h1>Current Auto Listings!</h1>
</div>
<div class="col-4"></div>
</div>
<br>
<!-- Page Content -->
<div class="container">
<!-- Page Heading -->
<div class="row" style= "background-color: #b9bec1">
</br>
<div class="col"></div>
<div class="col">
<div class="container">
<?php
//$sql = "SELECT * from listings where product_category = 'Aquatics';";
$sql ="SELECT * from listings, users where listings.username = users.username AND product_category = 'auto';";
//$sql = "SELECT * from listings,users where product_category = 'Aquatics' AND users.username = 'admin2';";
$query = mysqli_query($con,$sql);
?>
<br>
<div class="tg-wrap"><table class="tg" style="undefined;table-layout: fixed; width: 331px;">
<colgroup>
<col style="width: 100px">
<col style="width: 200px">
<col style="width: 149px">
<col style="width: 149px">
<col style="width: 149px">
</colgroup>
<tr>
<th class="tg-baqh">Product</th>
<th class="tg-baqh">Product Description</th>
<th class="tg-baqh">Price</th>
<th class="tg-baqh">Seller</th>
<th class="tg-baqh">Purchase</th>
</tr>
<?php
while ($row = mysqli_fetch_array($query)) {
$product = urlencode($row['product']);
$category = $row['product_category'];
$seller = $row['username'];
$price = $row['product_price'];
$userRating = $row['rating'];
echo "<tr>";
echo "<td>".$row['product']."</td>";
echo "<td>".$row['product_desc']."</td>";
echo "<td>$".$row['product_price']."</td>";
echo "<td><span data-toggle=tooltip title=$userRating>".$row['username']."</span></td>";
//echo "<td>".$row['rating']."</td>";
echo "<td><a href=review_order.php?product=".$product."&seller=".$seller."&price=".$price."&category=".$category." style=color:blue>Purchase</a></td>";
echo "</tr>";
}
?>
</table>
<br>
</div>
</div>
</div>
<div class="col"></div>
</div>
</div>
<!-- /.container -->
<!--footer-->
<nav class="navbar navbar-dark bg-dark fixed-bottom">
<?php if( isset($_SESSION['username']) && !empty($_SESSION['username']) )
{
?>
<div class="container text-center">
<p class="navbar-text col-md-12 col-sm-12 col-xs-12 text-white">Copyrighted by HonestCraig<sup>©</sup>
<br>
Logged in as: <?php echo htmlspecialchars($_SESSION['username']); ?>
<br>
<a href="logout.php" class="btn btn-danger">Sign Out</a>
</p>
</div>
<?php }else{ ?>
<div class="container text-center">
<p class="navbar-text col-md-12 col-sm-12 col-xs-12 text-white">
Copyrighted by HonestCraig<sup>©
<br>
<br>
<a href="login.php" class="btn btn-success">Sign in</a>
</p>
</div>
<?php } ?>>
</nav>
<!-- Bootstrap core JavaScript -->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script>
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});
</script>
</body>
</html>