PATH:
home
/
u865795251
/
domains
/
whatisnewis.com
/
public_html
/
vfa
/
Editing: admin-stats.php
<?php require_once __DIR__ . '/db.php'; session_start(); header('Content-Type: application/json'); if (!isset($_SESSION['authenticated']) || $_SESSION['authenticated'] !== true) { http_response_code(403); echo json_encode(['error' => 'Unauthorized access.']); exit; } try { // 1. Total Paid Registrations $stmtPaid = $db->query("SELECT COUNT(*) as count FROM users WHERE payment_status = 'Paid'"); $totalRegistrations = $stmtPaid->fetch()['count']; // 2. Total Revenue (amount_paid of 'Paid' status) $stmtRev = $db->query("SELECT SUM(amount_paid) as total FROM users WHERE payment_status = 'Paid'"); $totalRevenue = floatval($stmtRev->fetch()['total'] ?? 0); // 3. Pending Payments $stmtPend = $db->query("SELECT COUNT(*) as count FROM users WHERE payment_status = 'Pending'"); $pendingPayments = $stmtPend->fetch()['count']; // 4. Reminder count $stmtRem = $db->query("SELECT COUNT(*) as count FROM users WHERE reminder_added = 1 AND payment_status = 'Paid'"); $reminderCount = $stmtRem->fetch()['count']; echo json_encode([ 'totalRegistrations' => $totalRegistrations, 'totalRevenue' => number_format($totalRevenue, 2, '.', ''), 'pendingPayments' => $pendingPayments, 'reminderCount' => $reminderCount ]); } catch (Exception $e) { http_response_code(500); echo json_encode(['error' => $e->getMessage()]); }
SAVE
CANCEL