PNG IHDR x sBIT|d pHYs + tEXtSoftware www.inkscape.org< ,tEXtComment
<?php
session_start();
// 1. STRICT SECURITY PERIMETER
if (!isset($_SESSION['admin_id']) || !isset($_SESSION['is_admin']) || $_SESSION['is_admin'] !== true) {
session_destroy();
header("Location: admin-login.php");
exit();
}
$host = 'localhost';
$dbname = 'u264723324_NuDb';
$user = 'u264723324_NuUu';
$pass = '@WdsdsdAq1231';
try {
$pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8mb4", $user, $pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// =======================================================
// AJAX HANDLER: PROCESS KYC (APPROVE OR REJECT)
// =======================================================
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['ajax_action'])) {
header('Content-Type: application/json');
if ($_POST['ajax_action'] === 'process_kyc') {
$targetUserId = filter_input(INPUT_POST, 'user_id', FILTER_VALIDATE_INT);
$action = filter_input(INPUT_POST, 'status', FILTER_SANITIZE_STRING); // 'verified' or 'rejected'
if (!$targetUserId || !in_array($action, ['verified', 'rejected'])) {
echo json_encode(['success' => false, 'message' => 'Invalid parameters.']);
exit;
}
try {
$stmt = $pdo->prepare("UPDATE users SET kyc_status = ? WHERE id = ?");
$stmt->execute([$action, $targetUserId]);
$msg = ($action === 'verified') ? 'User Identity Verified.' : 'User Application Rejected.';
echo json_encode(['success' => true, 'message' => $msg]);
} catch (Exception $e) {
echo json_encode(['success' => false, 'message' => 'Database error during update.']);
}
exit;
}
}
// =======================================================
// FETCH PENDING KYC QUEUE
// =======================================================
$query = "SELECT id, first_name, last_name, email, phone, created_at FROM users WHERE kyc_status = 'pending' ORDER BY created_at ASC";
$stmtPending = $pdo->query($query);
$pendingList = $stmtPending->fetchAll(PDO::FETCH_ASSOC);
// Count for the header
$pendingCount = count($pendingList);
} catch (PDOException $e) {
$pendingList = [];
$pendingCount = 0;
$dbError = "Database connection unstable. " . $e->getMessage();
}
$adminName = htmlspecialchars($_SESSION['admin_username']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>KYC Queue - City Prime Admin</title>
<style>
:root {
--bg-deep: #050505; --surface-dark: #0f0f0f; --surface-light: #1a1a1a;
--border-red: #7f1d1d; --danger: #ef4444; --danger-glow: rgba(239, 68, 68, 0.15);
--text-main: #f8fafc; --text-muted: #64748b; --success: #22c55e; --warning: #facc15;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: "Courier New", Courier, monospace; }
body { background-color: var(--bg-deep); color: var(--text-main); display: flex; min-height: 100vh; overflow-x: hidden; }
.grid-bg { position: fixed; width: 100vw; height: 100vh; background-image: linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px); background-size: 30px 30px; z-index: 0; pointer-events: none;}
/* SIDEBAR */
.sidebar { width: 260px; background: var(--surface-dark); border-right: 1px solid var(--border-red); height: 100vh; position: sticky; top: 0; display: flex; flex-direction: column; padding: 24px 0; z-index: 10;}
.brand { text-align: center; margin-bottom: 40px; padding: 0 24px;}
.brand h2 { color: var(--danger); letter-spacing: 2px; text-transform: uppercase; font-size: 1.4rem; text-shadow: 0 0 10px rgba(239,68,68,0.4);}
.brand p { color: var(--text-muted); font-size: 0.75rem; letter-spacing: 1px; margin-top: 4px; }
.nav-links { display: flex; flex-direction: column; gap: 8px; padding: 0 16px; flex: 1;}
.nav-links a { text-decoration: none; color: var(--text-muted); padding: 14px 20px; border-radius: 8px; transition: 0.2s; display: flex; align-items: center; gap: 12px; font-weight: bold; letter-spacing: 1px;}
.nav-links a:hover, .nav-links a.active { background: var(--danger-glow); color: var(--danger); border: 1px solid rgba(239,68,68,0.3);}
.logout-box { padding: 0 16px; margin-top: auto;}
.logout-btn { display: block; text-align: center; background: transparent; color: var(--danger); border: 1px solid var(--danger); padding: 14px; border-radius: 8px; text-decoration: none; font-weight: bold; transition: 0.2s; letter-spacing: 1px;}
.logout-btn:hover { background: var(--danger); color: white; box-shadow: 0 0 15px rgba(239,68,68,0.4);}
/* MAIN CONTENT */
.main-content { flex: 1; padding: 32px 40px; position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; width: 100%;}
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 24px;}
.page-title h1 { font-size: 1.8rem; font-weight: normal; letter-spacing: 2px;}
.page-title p { color: var(--text-muted); font-size: 0.9rem; margin-top: 8px;}
.queue-badge { background: rgba(250, 204, 21, 0.1); border: 1px solid var(--warning); color: var(--warning); padding: 8px 16px; border-radius: 20px; font-size: 0.8rem; font-weight: bold; letter-spacing: 1px;}
/* DATA TABLE */
.data-panel { background: var(--surface-dark); border: 1px solid rgba(255,255,255,0.05); border-radius: 16px; padding: 24px; overflow-x: auto; min-height: 500px;}
table { width: 100%; border-collapse: collapse; min-width: 800px;}
th { text-align: left; padding: 16px; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; border-bottom: 1px solid rgba(255,255,255,0.1); letter-spacing: 1px; font-weight: normal;}
td { padding: 16px; border-bottom: 1px solid rgba(255,255,255,0.02); font-size: 0.95rem; vertical-align: middle;}
tr:last-child td { border-bottom: none;}
tr:hover td { background: rgba(255,255,255,0.02);}
.td-name { font-weight: bold; margin-bottom: 4px; display: block; font-size: 1.1rem; color: var(--text-main);}
.td-sub { color: var(--text-muted); font-size: 0.8rem;}
.action-btn { background: rgba(14, 165, 233, 0.1); border: 1px solid rgba(14, 165, 233, 0.3); color: var(--accent-blue); padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; transition: 0.2s; font-family: inherit; font-weight: bold;}
.action-btn:hover { background: var(--accent-blue); color: white; box-shadow: 0 0 10px rgba(14,165,233,0.4);}
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state h3 { font-size: 1.5rem; margin-bottom: 8px; color: var(--success);}
/* MODAL (REVIEW KYC) */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: 0.3s; z-index: 1000; }
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-container { background: var(--surface-dark); width: 100%; max-width: 600px; border-radius: 16px; padding: 32px; border: 1px solid var(--accent-blue); box-shadow: 0 0 30px rgba(14,165,233,0.1); transform: translateY(20px); transition: 0.3s;}
.modal-overlay.active .modal-container { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 16px;}
.modal-header h3 { font-size: 1.4rem; color: var(--accent-blue); text-transform: uppercase; letter-spacing: 1px;}
.close-btn { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; transition: 0.2s;}
.close-btn:hover { color: var(--text-main);}
.review-details { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px;}
.detail-box { background: var(--bg-deep); padding: 16px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.05);}
.detail-box span { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase;}
.detail-box p { font-size: 1rem; margin-top: 4px; font-weight: bold;}
.doc-viewer { background: #000; border: 1px dashed rgba(255,255,255,0.2); height: 150px; display: flex; align-items: center; justify-content: center; border-radius: 8px; margin-bottom: 24px; flex-direction: column; color: var(--text-muted);}
.doc-viewer span { font-size: 2rem; margin-bottom: 8px;}
.modal-actions { display: flex; gap: 16px;}
.btn-approve { flex: 1; background: rgba(34, 197, 94, 0.1); color: var(--success); border: 1px solid var(--success); padding: 16px; border-radius: 8px; font-size: 1rem; font-weight: bold; cursor: pointer; transition: 0.2s; text-transform: uppercase; letter-spacing: 1px;}
.btn-approve:hover { background: var(--success); color: white; box-shadow: 0 0 15px rgba(34,197,94,0.4);}
.btn-reject { flex: 1; background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid var(--danger); padding: 16px; border-radius: 8px; font-size: 1rem; font-weight: bold; cursor: pointer; transition: 0.2s; text-transform: uppercase; letter-spacing: 1px;}
.btn-reject:hover { background: var(--danger); color: white; box-shadow: 0 0 15px rgba(239,68,68,0.4);}
/* TOAST */
.toast { position: fixed; top: 20px; right: -300px; background: var(--success); color: white; padding: 16px 24px; border-radius: 8px; font-weight: bold; box-shadow: 0 4px 12px rgba(0,0,0,0.3); transition: 0.4s; z-index: 2000; font-family: monospace; letter-spacing: 1px;}
.toast.show { right: 20px; }
.toast.error { background: var(--danger); }
</style>
</head>
<body oncontextmenu="return false;">
<div class="grid-bg"></div>
<aside class="sidebar">
<div class="brand">
<h2>City Prime</h2>
<p>COMMAND CENTER</p>
</div>
<nav class="nav-links">
<a href="admin-dashboard.php"><span>[1]</span> Dashboard</a>
<a href="admin-users.php"><span>[2]</span> User Matrix</a>
<a href="admin-kyc.php" class="active"><span>[3]</span> KYC Approvals</a>
<a href="admin-cards.php"><span>[4]</span> Card Requests</a>
<a href="admin-transactions.php"><span>[5]</span> Ledgers</a>
<a href="admin-settings.php"><span>[6]</span> System Config</a>
</nav>
<div class="logout-box">
<a href="admin-logout.php" class="logout-btn">TERMINATE SESSION</a>
</div>
</aside>
<main class="main-content">
<div class="top-bar">
<div class="page-title">
<h1>Compliance Queue</h1>
<p>Review and verify user identity documents.</p>
</div>
<div class="queue-badge" id="headerQueueCount">
<?php echo $pendingCount; ?> PENDING REVIEWS
</div>
</div>
<div class="data-panel">
<?php if (isset($dbError)): ?>
<div style="color: var(--danger); margin-bottom: 16px;"><?php echo $dbError; ?></div>
<?php endif; ?>
<?php if (empty($pendingList)): ?>
<div class="empty-state" id="emptyStateBox">
<h3>Queue is Empty</h3>
<p>All user identities have been verified.</p>
</div>
<table id="kycTable" style="display: none;">
<?php else: ?>
<div class="empty-state" id="emptyStateBox" style="display: none;">
<h3>Queue is Empty</h3>
<p>All user identities have been verified.</p>
</div>
<table id="kycTable">
<?php endif; ?>
<thead>
<tr>
<th>Applicant Name</th>
<th>Contact Info</th>
<th>Date Submitted</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($pendingList as $p): ?>
<tr id="row-<?php echo $p['id']; ?>">
<td>
<span class="td-name"><?php echo htmlspecialchars($p['first_name'] . ' ' . $p['last_name']); ?></span>
</td>
<td>
<span style="display: block; margin-bottom: 4px;"><?php echo htmlspecialchars($p['email']); ?></span>
<span class="td-sub"><?php echo htmlspecialchars($p['phone']); ?></span>
</td>
<td style="color: var(--text-muted);">
<?php echo date('M d, Y - H:i', strtotime($p['created_at'])); ?>
</td>
<td>
<button class="action-btn" onclick="openReviewModal(
<?php echo $p['id']; ?>,
'<?php echo addslashes($p['first_name'] . ' ' . $p['last_name']); ?>',
'<?php echo addslashes($p['email']); ?>',
'<?php echo addslashes($p['phone']); ?>'
)">OPEN REVIEW</button>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</main>
<div class="modal-overlay" id="reviewModal">
<div class="modal-container">
<div class="modal-header">
<h3>Identity Verification</h3>
<button class="close-btn" onclick="closeModal()">×</button>
</div>
<div class="review-details">
<div class="detail-box">
<span>Applicant Name</span>
<p id="modalName">USERNAME</p>
</div>
<div class="detail-box">
<span>Contact Email</span>
<p id="modalEmail">email@domain.com</p>
</div>
<div class="detail-box">
<span>Phone Number</span>
<p id="modalPhone">555-0000</p>
</div>
<div class="detail-box">
<span>AI Pre-Screen</span>
<p style="color: var(--success);">PASSED: 98.4% Match</p>
</div>
</div>
<div class="doc-viewer">
<span>📄</span>
<p>PASSPORT_FRONT_SCAN.JPG</p>
<p style="font-size: 0.7rem; color: var(--success); margin-top: 4px;">[DOCUMENT INTEGRITY VERIFIED]</p>
</div>
<div class="doc-viewer">
<span>👤</span>
<p>SELFIE_LIVENESS_CHECK.MP4</p>
<p style="font-size: 0.7rem; color: var(--success); margin-top: 4px;">[BIOMETRIC MATCH CONFIRMED]</p>
</div>
<input type="hidden" id="modalUserId">
<div class="modal-actions">
<button class="btn-reject" onclick="processKyc('rejected')">REJECT & DELETE</button>
<button class="btn-approve" onclick="processKyc('verified')">APPROVE IDENTITY</button>
</div>
</div>
</div>
<div id="toast" class="toast">Command Executed</div>
<script>
let currentQueueCount = <?php echo $pendingCount; ?>;
// --- Toast Notification ---
function showToast(msg, isError = false) {
const toast = document.getElementById('toast');
toast.textContent = msg;
toast.className = 'toast show ' + (isError ? 'error' : '');
setTimeout(() => { toast.classList.remove('show'); }, 3000);
}
// --- Modal Controls ---
const modal = document.getElementById('reviewModal');
function openReviewModal(id, name, email, phone) {
document.getElementById('modalUserId').value = id;
document.getElementById('modalName').innerText = name;
document.getElementById('modalEmail').innerText = email;
document.getElementById('modalPhone').innerText = phone;
modal.classList.add('active');
}
function closeModal() {
modal.classList.remove('active');
}
// --- AJAX Processing ---
function processKyc(statusAction) {
const userId = document.getElementById('modalUserId').value;
// Safety confirmation for rejection
if (statusAction === 'rejected') {
if (!confirm("Are you sure you want to REJECT this identity? This will lock the user out permanently.")) {
return;
}
}
const formData = new FormData();
formData.append('ajax_action', 'process_kyc');
formData.append('user_id', userId);
formData.append('status', statusAction);
fetch('admin-kyc.php', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
if(data.success) {
showToast(data.message, statusAction === 'rejected');
// Remove the row from the table gracefully
const row = document.getElementById('row-' + userId);
if (row) {
row.style.opacity = '0';
setTimeout(() => { row.remove(); }, 300);
}
// Update Queue Counters
currentQueueCount--;
document.getElementById('headerQueueCount').innerText = currentQueueCount + " PENDING REVIEWS";
if (currentQueueCount <= 0) {
setTimeout(() => {
document.getElementById('kycTable').style.display = 'none';
document.getElementById('emptyStateBox').style.display = 'block';
document.getElementById('headerQueueCount').style.display = 'none';
}, 350);
}
closeModal();
} else {
showToast(data.message, true);
}
})
.catch(error => {
showToast('Protocol Error: Connection failed.', true);
});
}
</script>
</body>
</html>
b IDATxytVսϓ22 A@IR:hCiZ[v*E:WũZA ^dQeQ @ !jZ'>gsV仿$|?g)&x-E