🚀 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
$

📄 leads_export.php

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

$statusFilter = $_GET['status'] ?? '';
$sql = 'SELECT * FROM leads';
$params = [];
if (in_array($statusFilter, ['new', 'contacted', 'converted', 'closed'], true)) {
    $sql .= ' WHERE status = ?';
    $params[] = $statusFilter;
}
$sql .= ' ORDER BY created_at DESC';
$stmt = db()->prepare($sql);
$stmt->execute($params);
$leads = $stmt->fetchAll();

header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename="leads-export-' . date('Y-m-d') . '.csv"');

$out = fopen('php://output', 'w');
fputs($out, "\xEF\xBB\xBF"); // UTF-8 BOM so Excel renders special characters correctly
fputcsv($out, ['ID', 'Name', 'Phone', 'Email', 'Interested Country', 'Interested Course', 'Message', 'Source Page', 'Status', 'Date']);
foreach ($leads as $lead) {
    fputcsv($out, [
        $lead['id'], $lead['name'], $lead['phone'], $lead['email'],
        $lead['interested_country'], $lead['interested_course'], $lead['message'],
        $lead['source_page'], $lead['status'], $lead['created_at'],
    ]);
}
fclose($out);
exit;
← Back📥 Raw✏️ Edit🔒 Chmod
✨ File Manager Magic ✨