-
Notifications
You must be signed in to change notification settings - Fork 0
/
user-panel.php
74 lines (71 loc) · 3.71 KB
/
user-panel.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
<?php
require 'shared/error-reporting.php';
require 'shared/logout.php';
if ($_SESSION['is_logged'] != true)
{
session_destroy();
header("Location: index.php");
exit();
}
?>
<!DOCTYPE html>
<html lang="pl_PL">
<head>
<?php require 'shared/head.php'; ?>
<title>Rentito.pl | Profil użytkownika</title>
</head>
<body>
<?php require 'shared/header.php'; ?>
<main class="container text-dark" style="margin-top: 105px;">
<div class="row">
<div class="col">
<a href="change-user-password.php">> Zmień hasło</a>
<h2 class="mt-2 mb-5">Twoje wypożyczenia</h2>
<?php
require 'shared/database-connection.php';
$query = "SELECT `b`.`name`, `c`.`model`, `c`.`year_of_manufacture`, `ct`.`name`,`c`.`daily_rental_price`, `u`.`name`, `u`.`surname`, `u`.`email`, `u`.`phone_number`, `r`.`rental_start`, `r`.`rental_end`, `c`.`id_car` FROM `rental` AS `r` INNER JOIN `car` AS `c` ON `r`.`id_car` = `c`.`id_car` INNER JOIN `brand` AS `b` ON `c`.`id_brand` = `b`.`id_brand` INNER JOIN `car_type` AS `ct` ON `c`.`id_car_type` = `ct`.`id_car_type` INNER JOIN `user` AS `u` ON `r`.`id_user` = `u`.`id_user` WHERE `r`.`id_user` = '{$_SESSION['id_user']}' AND `r`.`is_returned` = '0';";
if($result = mysqli_query($connection, $query))
{
$count = mysqli_affected_rows($connection);
if($count === 0)
{
echo "
<p class='text-center text-muted my-3'>Nie znaleziono wypożyczeń!</p>
";
} else
{
while($rental = mysqli_fetch_row($result))
{
echo "
<div class='row no-gutters border rounded overflow-hidden flex-md-row mb-4 shadow-sm h-md-250 position-relative'>
<div class='col p-4 d-flex flex-column flex-md-row position-static align-items-md-end'>
<div>
<h3 class='mb-0 text-dark'><a href='offer-details.php?id_car=".$rental[11]."'>".$rental[0]." ".htmlspecialchars($rental[1], ENT_QUOTES | ENT_HTML5, 'UTF-8')."</a></h3>
<span class='mb-1 text-muted'>".$rental[2].' ● '.$rental[3]."</span>
<h2 class='my-3 text-muted'>".$rental[4]." zł/h</h3>
</div>
<div class='mx-md-3'>
<small>Początek wypożyczenia</small>
<p>{$rental[9]}</p>
</div>
<div class='mx-md-3'>
<small>Koniec wypożyczenia</small>
<p>{$rental[10]}</p>
</div>
</div>
</div>
";
}
}
} else
{
echo "Wystąpił błąd! Spróbuj ponownie później...";
}
mysqli_close($connection);
?>
</div>
</div>
</main>
<?php require 'shared/footer.php'; ?>
</body>
</html>