-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbaza_driver.php
125 lines (106 loc) · 3.09 KB
/
baza_driver.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
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
flex-direction: column;
}
table {
width: 100%;
max-width: 600px;
margin: 20px;
border-collapse: collapse;
background-color: white;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 8px;
overflow: hidden;
}
th, td {
padding: 15px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #4CAF50;
color: white;
}
tr:hover {
background-color: #f5f5f5;
}
@media (max-width: 600px) {
th, td {
display: block;
width: 100%;
box-sizing: border-box;
}
th {
text-align: center;
}
}
#logoutButton {
margin-top: 20px;
padding: 10px 20px;
background-color: #f44336;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
#logoutButton:hover {
background-color: #d32f2f;
}
</style>
<title>Список водителей</title>
</head>
<body>
<?php
$servername = "134.90.167.42:10306";
$username = "Shlyakhin";
$password = "WzIwnY";
$dbname = "project_Shlyakhin";
$conn = new mysqli($servername, $username, $password, $dbname);
// Проверка соединения
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// SQL-запрос для получения данных только с ролью Driver
$sql = "SELECT `id`, `Role`, `Name`, `Pass` FROM `Users` WHERE `Role` = 'Driver'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// Вывод данных в таблицу
echo '<table>';
echo '<thead><tr><th>ID</th><th>Роль</th><th>Логин</th><th>Пароль</th></tr></thead>';
echo '<tbody>';
while ($row = $result->fetch_assoc()) {
echo '<tr>';
echo '<td>' . $row['id'] . '</td>';
echo '<td>' . $row['Role'] . '</td>';
echo '<td>' . $row['Name'] . '</td>';
echo '<td>' . $row['Pass'] . '</td>';
echo '</tr>';
}
echo '</tbody></table>';
} else {
echo "<p>Нет результатов для роли 'Driver'</p>";
}
$conn->close();
?>
<!-- Кнопка выхода -->
<button id="logoutButton" onclick="logout()">Выйти</button>
<script>
function logout() {
window.location.href = 'dispatcher_dashboard.html'; // Укажите ваш путь к странице выхода
}
</script>
</body>
</html>