-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadmin.php
More file actions
41 lines (35 loc) · 1.42 KB
/
admin.php
File metadata and controls
41 lines (35 loc) · 1.42 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
<?php
session_start();
?>
<!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.0">
<title>Document</title>
</head>
<body>
<?php
session_start();
require_once "vendor/connect.php"; // Подразумевает, что connect.php содержит код для создания объекта $pdo
// Подготавливаем и выполняем запрос к базе данных для получения заявлений
$sql = $pdo->prepare("SELECT * FROM Complaints");
$sql->execute();
$complaints = $sql->fetchAll(PDO::FETCH_OBJ); // Получаем все заявления как массив объектов
?>
<!-- Выводим все заявления -->
<?php foreach ($complaints as $complaint): ?>
<div class="complaint">
<p>
<?= htmlspecialchars($complaint->complaint_text) ?>
</p>
<form action="vendor/admin_script.php" method="post">
<input type="hidden" name="complaint_id" value="<?= $complaint->complaint_id ?>">
<input type="submit" name="action" value="Принять">
<input type="submit" name="action" value="Отклонить">
</form>
</div>
<?php endforeach; ?>
</body>
</html>