0) { try { $panelPdo = getPanelDBConnection(); $panelPdo->beginTransaction(); $panelPdo->prepare("DELETE FROM point_transactions WHERE user_id = ?")->execute([$member_id]); $panelPdo->prepare("DELETE FROM user_points WHERE user_id = ?")->execute([$member_id]); $panelPdo->prepare("DELETE FROM redemption_requests WHERE user_id = ?")->execute([$member_id]); $panelPdo->prepare("DELETE FROM support_tickets WHERE user_id = ?")->execute([$member_id]); $panelPdo->prepare("DELETE FROM support_messages WHERE sender_type = 'user' AND sender_id = ?")->execute([$member_id]); $panelPdo->prepare("DELETE FROM user_profiler WHERE user_id = ?")->execute([$member_id]); $panelPdo->prepare("DELETE FROM profiler_completion WHERE user_id = ?")->execute([$member_id]); $panelPdo->prepare("DELETE FROM mobile_verifications WHERE user_id = ?")->execute([$member_id]); $panelPdo->prepare("DELETE FROM email_verifications WHERE user_id = ?")->execute([$member_id]); $panelPdo->prepare("DELETE FROM users WHERE id = ?")->execute([$member_id]); $panelPdo->commit(); logActivity($_SESSION['admin_id'], 'delete_member', "Deleted member #$member_id", 'member', $member_id); $success_message = 'Member deleted successfully!'; } catch (Exception $e) { $panelPdo->rollBack(); error_log("Delete member error: " . $e->getMessage()); $error_message = 'Error deleting member. Please try again.'; } } } // ========================================================= // HANDLE BULK VERIFICATION EMAIL SEND — batched AJAX endpoint // ========================================================= if (isset($_POST['send_verification_emails']) && isLoggedIn()) { @set_time_limit(120); ignore_user_abort(true); header('Content-Type: application/json'); $from_date = trim($_POST['from_date'] ?? ''); $to_date = trim($_POST['to_date'] ?? ''); $offset = max(0, intval($_POST['offset'] ?? 0)); $batch = 10; // emails per request if (empty($from_date) || empty($to_date)) { echo json_encode(['success' => false, 'message' => 'Please select both From and To dates.']); exit; } try { $panelPdo = getPanelDBConnection(); // Total count (always fresh so JS knows the full picture) $cntStmt = $panelPdo->prepare(" SELECT COUNT(*) FROM users WHERE email_verified = 0 AND DATE(created_at) >= ? AND DATE(created_at) <= ? "); $cntStmt->execute([$from_date, $to_date]); $total = (int)$cntStmt->fetchColumn(); if ($total === 0) { echo json_encode(['success' => true, 'done' => true, 'sent' => 0, 'failed' => 0, 'total' => 0, 'message' => 'No unverified members found in the selected date range.']); exit; } // Fetch this batch $stmt = $panelPdo->prepare(" SELECT id, email FROM users WHERE email_verified = 0 AND DATE(created_at) >= ? AND DATE(created_at) <= ? ORDER BY created_at ASC LIMIT {$batch} OFFSET {$offset} "); $stmt->execute([$from_date, $to_date]); $batchUsers = $stmt->fetchAll(); $sentCount = 0; $failedCount = 0; $firstError = null; foreach ($batchUsers as $user) { $panelPdo->prepare("DELETE FROM email_verifications WHERE user_id = ?") ->execute([$user['id']]); $token = bin2hex(random_bytes(32)); $expiresAt = date('Y-m-d H:i:s', strtotime('+48 hours')); $panelPdo->prepare(" INSERT INTO email_verifications (user_id, token, expires_at, created_at) VALUES (?, ?, ?, NOW()) ")->execute([$user['id'], $token, $expiresAt]); $verifyUrl = MEMBER_SITE_URL . '/verify.php?token=' . $token; $subject = 'Verify Your Email - Relevant Reflex'; $htmlBody = '
Welcome to India\'s Trusted Survey Platform
To activate your account and start earning through paid surveys, please verify your email address:
Note: This link expires in 48 hours.
If the button doesn\'t work: ' . $verifyUrl . '
Best regards,
The Relevant Reflex Team
Welcome to India\'s Trusted Survey Platform
To activate your account and start earning through paid surveys, please verify your email address:
Note: This link expires in 48 hours.
If the button doesn\'t work: ' . $verifyUrl . '
Best regards,
The Relevant Reflex Team
Manage all registered survey panel members
Sends a fresh 48-hour verification link to all members who registered in the selected date range and have not yet verified their email.
| ID | Gen | Date of Birth | Postcode | SEC | Points | Status | Joined | Actions | |
|---|---|---|---|---|---|---|---|---|---|
|
No panel members found
|
|||||||||
|
Verified
|
diff($dob)->y;
?>
format('d M Y'); ?>
y
|
'#059669','B'=>'#0d9488','C'=>'#2563eb','D'=>'#d97706','E'=>'#dc2626']; $bgc = $secColors[$member['isec_class']] ?? '#94a3b8'; ?> — | |||||||