403Webshell
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/public_html/crm/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/u390967363/public_html/crm/dashboard_1.php
<?php
session_start();
if (!isset($_SESSION['admin'])) {
  header("Location: login.html");
  exit();
}
require 'config.php';
include 'auth-guard.php';
$result = $conn->query("SELECT * FROM crm_entries ORDER BY submitted_at DESC");
$followUps = $conn->query("SELECT COUNT(*) as total FROM crm_entries WHERE follow_up_needed = 'Yes'")->fetch_assoc()['total'];
$converted = $conn->query("SELECT COUNT(*) as total FROM crm_entries WHERE lead_status LIKE '%Converted%'")->fetch_assoc()['total'];
$totalLeads = $conn->query("SELECT COUNT(*) as total FROM crm_entries")->fetch_assoc()['total'];

error_reporting(E_ALL);
ini_set('display_errors', 1);

$chartData = [
  'daily' => ['labels' => [], 'leads' => [], 'follow_ups' => [], 'converted' => []],
  'monthly' => ['labels' => [], 'leads' => [], 'follow_ups' => [], 'converted' => []],
  'yearly' => ['labels' => [], 'leads' => [], 'follow_ups' => [], 'converted' => []]
];

$dailyStats = $conn->query("
  SELECT 
    DATE(summary_date) as day,
    SUM(total_leads) as total,
    SUM(followups) as follow_ups,
    SUM(converted) as converted
  FROM lead_summary
  WHERE summary_date >= CURDATE() - INTERVAL 7 DAY
  GROUP BY day
  ORDER BY day ASC
");

$monthlyStats = $conn->query("
  SELECT 
    DATE_FORMAT(summary_date, '%Y-%m') as month,
    SUM(total_leads) as total,
    SUM(followups) as follow_ups,
    SUM(converted) as converted
  FROM lead_summary
  GROUP BY month
  ORDER BY month ASC
");

$yearlyStats = $conn->query("
  SELECT 
    YEAR(summary_date) as year,
    SUM(total_leads) as total,
    SUM(followups) as follow_ups,
    SUM(converted) as converted
  FROM lead_summary
  WHERE summary_date >= CURDATE() - INTERVAL 3 YEAR
  GROUP BY year
  ORDER BY year ASC
");

if (!$dailyStats || !$monthlyStats || !$yearlyStats) {
  die('Query error: ' . $conn->error);
}

while ($row = $dailyStats->fetch_assoc()) {
  $chartData['daily']['labels'][] = $row['day'];
  $chartData['daily']['leads'][] = (int)$row['total'] ?: 0;
  $chartData['daily']['follow_ups'][] = (int)$row['follow_ups'] ?: 0;
  $chartData['daily']['converted'][] = (int)$row['converted'] ?: 0;
}
while ($row = $monthlyStats->fetch_assoc()) {
  $chartData['monthly']['labels'][] = $row['month'];
  $chartData['monthly']['leads'][] = (int)$row['total'] ?: 0;
  $chartData['monthly']['follow_ups'][] = (int)$row['follow_ups'] ?: 0;
  $chartData['monthly']['converted'][] = (int)$row['converted'] ?: 0;
}
while ($row = $yearlyStats->fetch_assoc()) {
  $chartData['yearly']['labels'][] = $row['year'];
  $chartData['yearly']['leads'][] = (int)$row['total'] ?: 0;
  $chartData['yearly']['follow_ups'][] = (int)$row['follow_ups'] ?: 0;
  $chartData['yearly']['converted'][] = (int)$row['converted'] ?: 0;
}
?>
<?php include 'auth-guard.php'; ?>

<!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 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_1.php" class="block py-2 px-3 rounded bg-blue-700">Dashboard</a>
      <a href="home-crm.php" class="block py-2 px-3 rounded hover:bg-blue-700">CRM Entries</a>
      <a href="leads.php" class="block py-2 px-3 rounded hover:bg-blue-700">Leads</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">
        <div class="w-full md:hidden pb-4 mb-4 border-b border-gray-300 px-4 flex justify-between items-center">
          <img src="https://aibenproperties.com/wp-content/uploads/2024/09/Aiben-Group-Logo.png" alt="Aiben Logo" class="h-9">
          <button id="burger" class="text-blue-800">
            <i class="fas fa-bars text-xl"></i>
          </button>
        </div>
        <header class="flex justify-between items-center mb-6">
          <button id="burger" class="hidden text-blue-800"><i class="fas fa-bars text-xl"></i></button>
          <div class="flex items-center gap-2 text-center w-full justify-center">
            <span class="text-xl md:text-2xl font-bold md:font-semibold text-gray-700">Welcome to the AIBEN CRM Dashboard</span>
          </div>
        </header>
    
        <!-- Cards -->
        <div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
          <div class="bg-white shadow-md p-4 rounded">
            <h2 class="text-lg font-semibold">New Leads</h2>
            <p class="text-2xl mt-2 text-blue-700 font-bold"><?php echo $totalLeads; ?></p>
          </div>
          <div class="bg-white shadow-md p-4 rounded">
            <h2 class="text-lg font-semibold">Follow-Ups</h2>
            <p class="text-2xl mt-2 text-yellow-500 font-bold"><?php echo $followUps; ?></p>
          </div>
          <div class="bg-white shadow-md p-4 rounded">
            <h2 class="text-lg font-semibold">Converted</h2>
            <p class="text-2xl mt-2 text-green-600 font-bold"><?php echo $converted; ?></p>
          </div>
        </div>
    
        <!-- Chart -->
        <div class="mt-10">
          <div class="flex flex-col sm:flex-row items-start sm:items-center justify-between mb-4 gap-4">
            <h2 class="text-xl font-semibold text-gray-700">Leads Over Time</h2>
            <select id="chartViewSelector" class="border rounded px-3 py-1 text-sm">
              <option value="daily" selected>Daily</option>
              <option value="monthly">Monthly</option>
              <option value="yearly">Yearly</option>
            </select>
          </div>
        
          <div class="w-full overflow-x-auto">
            <div class="relative w-full" style="height: 320px;">
              <canvas id="leadsChart" class="w-full h-full"></canvas>
            </div>
          </div>
        </div>
    </main>

  <!-- Scripts -->
  <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  <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");
    });

    const chartData = <?= json_encode($chartData) ?>;
    const ctx = document.getElementById('leadsChart').getContext('2d');
    let currentView = 'daily';
    
    const leadsChart = new Chart(ctx, {
      type: 'bar',
      data: {
        labels: chartData[currentView].labels,
        datasets: [
          {
            label: 'Total Leads',
            data: chartData[currentView].leads,
            backgroundColor: 'rgba(54, 162, 235, 0.6)',
            borderColor: 'rgba(54, 162, 235, 1)',
            borderWidth: 1,
            barThickness: 20
          },
          {
            label: 'Follow-Ups',
            data: chartData[currentView].follow_ups,
            backgroundColor: 'rgba(255, 206, 86, 0.6)',
            borderColor: 'rgba(255, 206, 86, 1)',
            borderWidth: 1,
            barThickness: 20
          },
          {
            label: 'Converted',
            data: chartData[currentView].converted,
            backgroundColor: 'rgba(75, 192, 192, 0.6)',
            borderColor: 'rgba(75, 192, 192, 1)',
            borderWidth: 1,
            barThickness: 20
          }
        ]
      },
      options: {
        responsive: true,
        maintainAspectRatio: false, // Allow height to be defined by container
        scales: {
          y: {
            beginAtZero: true,
            title: { display: true, text: 'Lead Count' },
            ticks: {
                        stepSize: 1
                    },
          },
          x: {
            title: { display: true, text: 'Time Period' }
          }
        },
        plugins: {
          legend: { display: true },
          title: { display: true, text: 'Lead Status Over Time' }
        }
      }
    });
    
    document.getElementById('chartViewSelector').addEventListener('change', function () {
      currentView = this.value;
      leadsChart.data.labels = chartData[currentView].labels;
      leadsChart.data.datasets[0].data = chartData[currentView].leads;
      leadsChart.data.datasets[1].data = chartData[currentView].follow_ups;
      leadsChart.data.datasets[2].data = chartData[currentView].converted;
      leadsChart.update();
    });
  </script>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit