-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
85 lines (79 loc) · 3.82 KB
/
Copy pathadmin.php
File metadata and controls
85 lines (79 loc) · 3.82 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
<?php
require_once 'config.php';
if (!isset($_SESSION['user_id'])) {
header('Location: index.php');
exit;
}
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
$me = $stmt->fetch();
if (!$me || !$me['is_admin']) {
header('Location: dashboard.php');
exit;
}
// Action: Manual Activation
if (isset($_GET['activate'])) {
$targetId = (int)$_GET['activate'];
$stmt = $pdo->prepare("UPDATE users SET has_access = 1 WHERE id = ?");
$stmt->execute([$targetId]);
header('Location: admin.php');
exit;
}
$users = $pdo->query("SELECT * FROM users ORDER BY id DESC")->fetchAll();
?>
<!DOCTYPE html>
<html lang="ru" class="dark">
<head>
<meta charset="UTF-8">
<title>Админ-панель - Vantuz</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
body { background-color: #09090b; }
.zinc-panel { background-color: #18181b; border: 1px solid #27272a; }
</style>
</head>
<body class="text-zinc-100 min-h-screen p-8">
<div class="max-w-6xl mx-auto">
<header class="flex justify-between items-center mb-12 border-b border-zinc-800 pb-4">
<h1 class="text-xl font-bold tracking-widest uppercase">Admin <span class="text-zinc-500">Panel</span></h1>
<a href="dashboard.php" class="text-xs uppercase text-zinc-400 hover:text-zinc-100 transition-colors">← Назад</a>
</header>
<div class="zinc-panel rounded-lg overflow-hidden">
<table class="w-full text-left text-sm">
<thead class="bg-zinc-900 border-b border-zinc-800">
<tr>
<th class="p-4 text-xs uppercase font-bold text-zinc-500">ID</th>
<th class="p-4 text-xs uppercase font-bold text-zinc-500">Пользователь</th>
<th class="p-4 text-xs uppercase font-bold text-zinc-500">Email</th>
<th class="p-4 text-xs uppercase font-bold text-zinc-500">Баланс</th>
<th class="p-4 text-xs uppercase font-bold text-zinc-500">Доступ</th>
<th class="p-4 text-xs uppercase font-bold text-zinc-500 text-right">Действие</th>
</tr>
</thead>
<tbody class="divide-y divide-zinc-800">
<?php foreach ($users as $u): ?>
<tr class="hover:bg-zinc-900/50 transition-colors">
<td class="p-4 font-mono text-zinc-500"><?= $u['id'] ?></td>
<td class="p-4 font-medium"><?= htmlspecialchars($u['username']) ?></td>
<td class="p-4 text-zinc-400"><?= htmlspecialchars($u['email']) ?></td>
<td class="p-4"><?= $u['balance'] ?> RUB</td>
<td class="p-4">
<?php if ($u['has_access']): ?>
<span class="text-green-500 text-[10px] font-bold uppercase">Активен</span>
<?php else: ?>
<span class="text-red-500 text-[10px] font-bold uppercase">Закрыт</span>
<?php endif; ?>
</td>
<td class="p-4 text-right">
<?php if (!$u['has_access']): ?>
<a href="admin.php?activate=<?= $u['id'] ?>" class="text-[10px] uppercase font-bold text-zinc-900 bg-zinc-100 px-3 py-1 rounded hover:bg-zinc-300">Активировать</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</body>
</html>