| Server IP : 72.60.21.38 / Your IP : 216.73.216.25 Web Server : LiteSpeed System : Linux uk-fast-web1372.main-hosting.eu 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64 User : u390967363 ( 390967363) PHP Version : 8.2.30 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/u390967363/domains/aibenproperties.com/public_html/crm/ |
Upload File : |
<?php
require 'config.php';
include 'auth-guard.php';
require 'super-guard.php';
// Query to fetch both admins and super admins
$adminsResult = $conn->query("SELECT id, name, email, created_at FROM admins ORDER BY id DESC");
$superAdminsResult = $conn->query("SELECT id, name, email, created_at FROM super_admins ORDER BY id DESC");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Aiben CRM Dashboard</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" />
</head>
<body class="bg-gray-100 min-h-screen flex flex-col md:flex-row">
<!-- Sidebar -->
<aside id="sidebar" class="fixed md:static top-0 left-0 z-40 w-full md:w-64 bg-blue-800 text-white h-screen p-6 space-y-6 transition-transform -translate-x-full md:translate-x-0" style="transition: transform 0.3s;">
<div class="text-2xl font-semibold flex justify-between items-center">
<img src="https://aibenproperties.com/wp-content/uploads/2024/09/logo-web.png" alt="Aiben Logo" class="h-7">
<button class="md:hidden text-white" id="close"><i class="fas fa-times text-xl"></i></button>
</div>
<nav class="space-y-4">
<a href="dashboard_2.php" class="block py-2 px-3 rounded hover:bg-blue-700">Dashboard</a>
<a href="super-crm.php" class="block py-2 px-3 rounded hover:bg-blue-700">CRM Entries</a>
<a href="superLeads.php" class="block py-2 px-3 rounded hover:bg-blue-700">Leads</a>
<a href="admins.php" class="block py-2 px-3 rounded bg-blue-700">Staff</a>
<a href="add-admin.php" class="block py-2 px-3 rounded hover:bg-blue-700">+ Add New Admin</a>
<a href="logout.php" class="block py-2 px-3 rounded bg-white text-red-600 hover:bg-red-700 hover:text-white text-center font-semibold">Logout</a>
</nav>
</aside>
<!-- Main content -->
<main class="flex-1 p-4 md:p-6 mt-2 md:mt-0 max-h-screen w-full max-w-screen-xl mx-auto">
<h1 class="text-2xl font-bold text-gray-700 mb-4 flex justify-between">
Admin Accounts
<button id="burger" class="text-blue-800 md:hidden">
<i class="fas fa-bars text-xl"></i>
</button>
</h1>
<div class="bg-white shadow rounded-lg p-4">
<div class="overflow-x-auto">
<table class="min-w-full table-auto border-collapse">
<thead>
<tr class="bg-gray-200 text-left">
<th class="px-4 py-2 whitespace-nowrap">Name</th>
<th class="px-4 py-2 whitespace-nowrap">Email</th>
<th class="px-4 py-2 whitespace-nowrap">Date Created</th>
<th class="px-4 py-2 whitespace-nowrap">Role</th>
<th class="px-4 py-2 whitespace-nowrap">Actions</th>
</tr>
</thead>
<tbody>
<?php
// Display regular admins
if ($adminsResult->num_rows > 0) {
while($admin = $adminsResult->fetch_assoc()) {
?>
<tr class="border-b hover:bg-gray-100">
<td class="px-4 py-2"><?php echo htmlspecialchars($admin['name']); ?></td>
<td class="px-4 py-2"><?php echo htmlspecialchars($admin['email']); ?></td>
<td class="px-4 py-2"><?php echo htmlspecialchars($admin['created_at']); ?></td>
<td class="px-4 py-2">
<span class="text-blue-700 bg-blue-100 text-sm font-semibold px-2 py-1 rounded">Admin</span>
</td>
<td class="px-4 py-2">
<a href="edit-admin.php?id=<?php echo $admin['id']; ?>" class="text-blue-600 hover:underline mr-2">Edit</a>
<a href="delete-admin.php?id=<?php echo $admin['id']; ?>&role=admin" onclick="return confirm('Are you sure?');" class="text-red-600 hover:underline">Delete</a>
</td>
</tr>
<?php
}
}
// Display super admins
if ($superAdminsResult->num_rows > 0) {
while($superAdmin = $superAdminsResult->fetch_assoc()) {
?>
<tr class="border-b hover:bg-gray-100">
<td class="px-4 py-2"><?php echo htmlspecialchars($superAdmin['name']); ?></td>
<td class="px-4 py-2"><?php echo htmlspecialchars($superAdmin['email']); ?></td>
<td class="px-4 py-2"><?php echo htmlspecialchars($superAdmin['created_at']); ?></td>
<td class="px-4 py-2">
<span class="text-red-700 bg-red-100 text-sm font-semibold px-2 py-1 rounded">Super Admin</span>
</td>
<td class="px-4 py-2">
<a href="edit-admin.php?id=<?php echo $superAdmin['id']; ?>" class="text-blue-600 hover:underline mr-2">Edit</a>
<a href="delete-admin.php?id=<?php echo $superAdmin['id']; ?>&role=super_admin" onclick="return confirm('Are you sure?');" class="text-red-600 hover:underline">Delete</a>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</main>
<?php if (isset($_GET['deleted'])): ?>
<div class="bg-green-100 text-green-700 p-2 rounded mb-4 absolute">
Admin deleted successfully.
</div>
<?php endif; ?>
<script>
const sidebar = document.getElementById("sidebar");
document.getElementById("burger").addEventListener("click", () => {
sidebar.classList.remove("-translate-x-full");
});
document.getElementById("close").addEventListener("click", () => {
sidebar.classList.add("-translate-x-full");
});
</script>
</body>
</html>