| Server IP : 93.86.61.54 / Your IP : 216.73.216.60 Web Server : Apache/2.4.62 (Ubuntu) System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64 User : www-data ( 33) PHP Version : 8.4.22 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/projects/meteo-ca/ |
Upload File : |
<?php
session_start();
require 'db.php';
require 'activity_log.php';
if (!isset($_SESSION["username"]) || $_SESSION["role"] !== 'admin') {
header("Location: login.php");
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Admin Panel</title>
<!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<link rel="stylesheet" type="text/css" href="css/bootstrap533.css">
</head>
<body class="bg-light">
<div class="container mt-5">
<div class="card shadow p-4">
<h2 class="text-center mb-4">Admin Panel</h2>
<p class="text-center">Dobrodošli, <strong><?php echo htmlspecialchars($_SESSION["username"]); ?></strong> (Admin)</p>
<div class="d-flex justify-content-between mb-3">
<a href="dashboard.php" class="btn btn-secondary">Kontrolni panel</a>
<a href="logout.php" class="btn btn-danger">Odjava</a>
</div>
<hr>
<h4>Registrovani korisnici</h4>
<table class="table table-bordered">
<thead class="table-light">
<tr>
<th>ID</th>
<th>Korisničko ime</th>
<th>Email</th>
<th>Uloga korisnika</th>
<th>Registrovan</th>
</tr>
</thead>
<tbody>
<?php
$result = $conn->query("SELECT id, username, email, role, created_at FROM users ORDER BY id DESC");
while ($row = $result->fetch_assoc()) {
echo "<tr>
<td>{$row['id']}</td>
<td>{$row['username']}</td>
<td>{$row['email']}</td>
<td>{$row['role']}</td>
<td>{$row['created_at']}</td>
</tr>";
}
?>
</tbody>
</table>
<hr>
<h4>Logovi aktivnosti</h4>
<table class="table table-striped">
<thead class="table-light">
<tr>
<th>Korisničko ime</th>
<th>Akcija</th>
<th>Vreme</th>
</tr>
</thead>
<tbody>
<?php
$logs = $conn->query("SELECT username, action, timestamp FROM activity_log ORDER BY id DESC LIMIT 50");
while ($log = $logs->fetch_assoc()) {
echo "<tr>
<td>{$log['username']}</td>
<td>{$log['action']}</td>
<td>{$log['timestamp']}</td>
</tr>";
}
?>
</tbody>
</table>
</div>
</div>
</body>
</html>