| Server IP : 3.111.61.48 / Your IP : 216.73.216.67 Web Server : Apache System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.2.31 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/vhost/book.gyaniguru.org/admin/includes/ |
Upload File : |
<?php
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
require_once __DIR__ . '/../../includes/db.php';
// Check if admin is logged in
if (!isset($_SESSION['admin_id'])) {
header("Location: login.php");
exit();
}
$current_page = basename($_SERVER['PHP_SELF']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GyaniGuru by JMC Admin</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css">
<link rel="stylesheet" href="../css/style.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
:root {
--sidebar-width: 260px;
}
body {
background: #fdfaf5;
color: var(--text-dark);
overflow-x: hidden;
font-family: 'Poppins', sans-serif;
}
.sidebar {
width: var(--sidebar-width);
height: 100vh;
height: 100dvh;
position: fixed;
left: 0;
top: 0;
background: #fffcf8;
border-right: 1px solid var(--cream-dark);
padding: 40px 20px;
z-index: 1000;
display: flex;
flex-direction: column;
box-shadow: 2px 0 15px rgba(0,0,0,0.03);
transition: left 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-link-admin {
display: flex;
align-items: center;
gap: 15px;
padding: 14px 18px;
color: var(--text-medium);
text-decoration: none !important;
border-radius: 12px;
margin-bottom: 8px;
transition: all 0.3s ease;
font-size: 0.95rem;
font-weight: 500;
}
.nav-link-admin i {
font-size: 1.1rem;
color: var(--gerua);
}
.nav-link-admin:hover {
background: var(--warm-white);
color: var(--maroon);
}
.nav-link-admin.active {
background: var(--maroon);
color: white;
font-weight: 600;
box-shadow: 0 4px 12px rgba(128,0,32,0.15);
}
.nav-link-admin.active i {
color: var(--gold);
}
.main-content {
margin-left: var(--sidebar-width);
padding: 40px;
min-height: 100vh;
transition: margin-left 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.sidebar-divider {
height: 1px;
background: linear-gradient(90deg, transparent, rgba(212,175,55,0.2), transparent);
margin: 20px 0;
}
.admin-card {
background: white;
border: 1px solid var(--cream-dark);
border-radius: 15px;
padding: 25px;
box-shadow: 0 10px 30px rgba(0,0,0,0.04);
}
.admin-card h5 {
color: var(--maroon);
font-family: 'Cinzel Decorative', cursive;
font-weight: 700;
}
.stat-card {
padding: 20px;
border-radius: 15px;
background: linear-gradient(135deg, rgba(212, 175, 55, 0.05), rgba(0, 0, 0, 0));
border: 1px solid rgba(212, 175, 55, 0.1);
display: flex;
align-items: center;
gap: 20px;
}
.stat-icon {
width: 50px;
height: 50px;
border-radius: 12px;
background: var(--gradient-saffron);
display: flex;
align-items: center;
justify-content: center;
color: var(--dark-bg);
font-size: 1.5rem;
}
.stat-info h3 { margin: 0; font-size: 1.8rem; color: var(--maroon); font-weight: 800; }
.stat-info p { margin: 0; font-size: 0.85rem; color: var(--text-medium); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.table-custom {
color: var(--text-dark);
border-collapse: separate;
border-spacing: 0 10px;
}
.table-custom thead th {
background: transparent;
border: none;
color: var(--gold);
font-size: 0.85rem;
text-transform: uppercase;
letter-spacing: 1px;
padding: 10px 20px;
}
.table-custom tbody tr {
background: white;
transition: 0.3s;
}
.table-custom tbody tr:hover {
background: var(--warm-white);
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}
.table-custom tbody td {
border: none;
padding: 18px 20px;
vertical-align: middle;
color: var(--text-dark);
font-weight: 500;
}
.table-custom tbody tr td:first-child { border-radius: 10px 0 0 10px; }
.table-custom tbody tr td:last-child { border-radius: 0 10px 10px 0; }
.status-badge {
padding: 5px 12px;
border-radius: 20px;
font-size: 0.75rem;
font-weight: 600;
}
.status-pending { background: rgba(255, 193, 7, 0.1); color: #ffc107; }
.status-delivered { background: rgba(40, 167, 69, 0.1); color: #28a745; }
.status-cancelled { background: rgba(220, 53, 69, 0.1); color: #dc3545; }
.btn-action {
width: 32px;
height: 32px;
border-radius: 8px;
display: inline-flex;
align-items: center;
justify-content: center;
text-decoration: none;
transition: 0.3s;
border: none;
}
.sidebar-toggle {
display: none;
position: fixed;
top: 12px;
left: 12px;
z-index: 999;
width: 40px;
height: 40px;
border-radius: 10px;
background: var(--maroon);
border: none;
color: white;
font-size: 1.3rem;
cursor: pointer;
align-items: center;
justify-content: center;
box-shadow: 0 4px 15px rgba(128,0,32,0.3);
}
.sidebar-backdrop {
display: none;
position: fixed;
inset: 0;
background: rgba(0,0,0,0.4);
z-index: 999;
opacity: 0;
visibility: hidden;
transition: opacity 0.35s ease;
}
.sidebar-backdrop.active {
opacity: 1;
visibility: visible;
}
@media (max-width: 991px) {
.sidebar {
left: calc(-1 * var(--sidebar-width));
}
.sidebar.open {
left: 0;
}
.main-content {
margin-left: 0;
padding: 30px 20px;
}
.sidebar-toggle {
display: flex;
}
.sidebar-backdrop {
display: block;
}
.stat-card {
padding: 15px;
}
.stat-info h3 {
font-size: 1.4rem;
}
.admin-card {
padding: 18px;
}
.admin-card h5 {
font-size: 1rem;
}
.d-flex.justify-content-between.align-items-center.mb-4 {
padding-left: 45px;
}
.table-custom thead th,
.table-custom tbody td {
padding: 12px 14px;
font-size: 0.82rem;
white-space: nowrap;
}
}
@media (max-width: 576px) {
.main-content {
padding: 20px 12px;
}
.admin-card {
padding: 15px;
}
.stat-icon {
width: 40px;
height: 40px;
font-size: 1.2rem;
}
.stat-info h3 {
font-size: 1.2rem;
}
.d-flex.justify-content-between.align-items-center.mb-4 {
flex-direction: column;
align-items: flex-start !important;
gap: 8px;
padding-left: 0;
padding-top: 50px;
}
.d-flex.justify-content-between.align-items-center.mb-4 h2 {
font-size: 1.3rem;
}
}
</style>
</head>
<body>
<button class="sidebar-toggle" id="sidebarToggle" onclick="toggleSidebar()" aria-label="Toggle sidebar">
<i class="bi bi-list"></i>
</button>
<div class="sidebar-backdrop" id="sidebarBackdrop" onclick="toggleSidebar()"></div>
<div class="sidebar">
<div class="mb-5 text-center">
<div class="mx-auto mb-3" style="width:50px; height:50px;"><img src="../images/logo/logo.png" alt="GyaniGuru" style="width:100%;height:100%;object-fit:contain"></div>
<h5 class="font-cinzel" style="color:var(--gold)">GyaniGuru by JMC</h5>
<small class="text-muted">ADMIN PANEL</small>
</div>
<nav>
<a href="index.php" class="nav-link-admin <?php echo $current_page == 'index.php' ? 'active' : ''; ?>">
<i class="bi bi-speedometer2"></i> Dashboard
</a>
<a href="books.php" class="nav-link-admin <?php echo $current_page == 'books.php' || $current_page == 'book-add.php' || $current_page == 'book-edit.php' ? 'active' : ''; ?>">
<i class="bi bi-book"></i> Books
</a>
<a href="photos.php" class="nav-link-admin <?php echo $current_page == 'photos.php' || $current_page == 'photo-add.php' || $current_page == 'photo-edit.php' ? 'active' : ''; ?>">
<i class="bi bi-images"></i> Guru Photos
</a>
<?php
$cat_count = get_row("SELECT COUNT(*) as count FROM categories")['count'];
if($cat_count > 0): ?>
<a href="categories.php" class="nav-link-admin <?php echo $current_page == 'categories.php' ? 'active' : ''; ?>">
<i class="bi bi-grid"></i> Categories
</a>
<?php endif; ?>
<a href="orders.php" class="nav-link-admin <?php echo $current_page == 'orders.php' ? 'active' : ''; ?>">
<i class="bi bi-cart"></i> Orders
</a>
<a href="users.php" class="nav-link-admin <?php echo $current_page == 'users.php' ? 'active' : ''; ?>">
<i class="bi bi-people"></i> Users
</a>
<div class="sidebar-divider"></div>
<a href="../index.php" class="nav-link-admin">
<i class="bi bi-globe"></i> View Website
</a>
<a href="logout.php" class="nav-link-admin text-danger">
<i class="bi bi-box-arrow-right"></i> Logout
</a>
</nav>
<div class="mt-auto p-3 admin-card shadow-sm" style="background: var(--warm-white); border: 1px solid var(--cream-dark);">
<div class="d-flex align-items-center gap-3">
<div style="width:45px;height:45px;border-radius:12px;background: var(--maroon);display:flex;align-items:center;justify-content:center;color:white;font-weight:bold;font-size:1.2rem">
<?php echo substr($_SESSION['admin_name'] ?? 'A', 0, 1); ?>
</div>
<div>
<div style="font-size: 0.9rem; font-weight:700; color: var(--maroon);"><?php echo $_SESSION['admin_name'] ?? 'Admin'; ?></div>
<div style="font-size: 0.75rem; color: var(--text-light)">System Controller</div>
</div>
</div>
</div>
</div>
<div class="main-content">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2 class="font-cinzel"><?php
switch($current_page) {
case 'books.php': echo 'Manage Books'; break;
case 'book-add.php': echo 'Add New Book'; break;
case 'book-edit.php': echo 'Edit Book'; break;
case 'photos.php': echo 'Manage Guru Photos'; break;
case 'photo-add.php': echo 'Add New Guru Photo'; break;
case 'photo-edit.php': echo 'Edit Guru Photo'; break;
case 'categories.php': echo 'Categories'; break;
case 'orders.php': echo 'Manage Orders'; break;
case 'users.php': echo 'Registered Users'; break;
default: echo 'Dashboard';
}
?></h2>
<div class="text-muted small">
<?php echo date('l, d F Y'); ?>
</div>
</div>