-
Notifications
You must be signed in to change notification settings - Fork 0
/
lorry.php
278 lines (171 loc) · 5.4 KB
/
lorry.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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
body {
font-family: "Lato", sans-serif;
}
.sidebar {
height: 100%;
width: 0;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
}
.sidebar a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
transition: 0.3s;
}
.sidebar a:hover {
color: #f1f1f1;
}
.sidebar .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
margin-left: 50px;
}
.openbtn {
font-size: 20px;
cursor: pointer;
background-color: #111;
color: white;
padding: 10px 15px;
border: none;
}
.openbtn:hover {
background-color: #444;
}
#main {
transition: margin-left .5s;
padding: 16px;
}
/* On smaller screens, where height is less than 450px, change the style of the sidenav (less padding and a smaller font size) */
@media screen and (max-height: 450px) {
.sidebar {padding-top: 15px;}
.sidebar a {font-size: 18px;}
}
</style>
</head>
<body>
<?php
session_start();
if(!isset($_SESSION ["email"]))
{
header("Location:login.php");
}
else
{
$DBHOST = "localhost";
$DBUSER = "Vehiclemanagement";
$DBPWD = "Vehiclemanagement123";
$DBNAME = "vehiclemanagement";
$conn = new mysqli($DBHOST, $DBUSER, $DBPWD, $DBNAME);
if($conn->connect_error)
{
die("Connection failed!".$conn->connect_error);
}
echo"<div id='main'>";
echo "<img id = 'logo' src = 'images/cover.png' width='125px'>";
echo "<b>Welcome, </b>" . $_SESSION['email'] ;
echo "<br>";
echo" <button class='openbtn' onclick='openNav()'>☰ Menu</button>";
echo "<script>
function myFunction() {
alert('Thank you for Coming, see you again!');
}
</script>
";
echo"<div class='container'>";
echo" <div class = 'navbar'>";
echo" <nav>";
echo" <ul>";
echo" <li><a href='truck.php'class='link' ><button>Trucks</button></a></li>";
echo" <li><a href='bus.php' class='link'><button>Buses</button></a></li>";
echo" <li><a href='display_vehicles.php'class='link' ><button>Back to display page</button></a></li>";
echo" <li><a href='coupe.php' class='link'><button>coupes</button></a></li>";
echo" <li><a href='suv.php' class='link'><button>Suvs</button></a></li>";
echo"</ul>";
echo"</nav>";
echo"</div>";
echo" </div>";
echo "<br>";
echo"<div id='mySidebar' class='sidebar'>";
echo" <a href='javascript:void(0)' class='closebtn' onclick='closeNav()'>×</a>";
echo" <a href='add_item.php'>Sell Vehicle</a>";
echo" <a href='uploaded.php'>Uploaded Vehicles</a>";
echo" <a href='bought.php'>Bought Vehicles</a>";
echo" <a href='profile.php'>Edit Account</a>";
echo" <a href='delete_buyer.php'>Delete Account</a>";
echo" <a href='passwd_reset.php'>Reset Password</a>";
echo "<br>";
echo "<a href='logout.php' onclick='myFunction()' >Sign out</a>";
echo"</div>";
$email = $_SESSION['email'];
$statement = "SELECT * FROM vehicle WHERE vehicle_category ='Lorry'";
$result = $conn->query($statement);
while($row = $result->fetch_assoc())
{
$iid = $row["vehicle_id"];
$iname = $row["vehicle_type"];
$ipic = $row["vehicle_picture"];
$day_uploaded = $row["day_uploaded"];
$vehicle_category = $row["vehicle_category"];
$vehicle_price = $row["vehicle_price"];
$iimg = "images/";
$iimg = $iimg.$row["vehicle_picture"];
$i_desc = $row["vehicle_desc"];
$payment_method = $row["payment_method"];
$vehicle_seller = $row["vehicle_seller"];
$vehicle_number_plate = $row["vehicle_number_plate"];
$link = "vehicle_details.php?vehicle_id=";
$vehicle_details = $link.$iid;
echo "<div class = 'item'>";
echo "<div class = 'item_row'>Vehicle Id : $iid</div>";
echo "<br>";
echo "<div class = 'item_row'>Vehicle Type : $iname</div>";
echo "<img class = 'item_img' src = '$iimg' alt='image'>";
echo "<div class = 'item_row'><b><h3>Vehcle Plate : $vehicle_number_plate </h3></b></div>";
echo "<div class = 'item_row'><b><h3>Vehicle Price : $vehicle_price </h3></b></div>";
echo "<div class = 'item_row'> Payment Method : $payment_method</div>";
echo "<br>";
echo "<div class = 'item_row'> Vehicle Category : $vehicle_category</div>";
echo "<br>";
echo "<div class = 'item_row'> Seller details : $vehicle_seller</div>";
echo "<br>";
echo "<form action = '' method='POST'>";
echo "<input type = 'hidden' name='vehicle_id' value = '$iid' >";
echo "<input type = 'hidden' name = 'email' value = '$email'>";
echo "</form>";
echo "<div class = 'item_row'><a class = 'link' href='$vehicle_details'><button>Vehicle Details </button></a></div>";
echo "</div>";
}/* display all the items on screen*/
$conn->close();
}/* prevent direct access by the user*/
echo"</div>";
echo"<script>;
function openNav() {
document.getElementById('mySidebar').style.width = '250px';
document.getElementById('main').style.marginLeft = '250px';
}
function closeNav() {
document.getElementById('mySidebar').style.width = '0';
document.getElementById('main').style.marginLeft= '0';
}
</script>";
echo "<br>";
?>
</body>
</html>