PNG IHDR x sBIT|d pHYs + tEXtSoftware www.inkscape.org< ,tEXtComment
<?php
// ---------------- Enable Errors (development mode) ----------------
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once "../config.php";
session_start();
// ---------- Helpers ----------
function param_user_id($id) {
// Accept raw binary or 32-char hex string. Return binary for DB queries.
if (is_string($id) && ctype_xdigit($id) && strlen($id) === 32) {
return hex2bin($id);
}
return $id;
}
function safe_echo($v){ echo htmlspecialchars($v ?? '', ENT_QUOTES|ENT_SUBSTITUTE); }
function id_to_hex($bin) {
if ($bin === null) return '';
// if already hex string
if (is_string($bin) && ctype_xdigit($bin) && strlen($bin) === 32) return $bin;
return bin2hex((string)$bin);
}
// ---------------- Security: Check authentication ----------------
if (!isset($_SESSION['auth'])) {
header("Location: ../login.php");
exit;
}
$user_id = $_SESSION['auth'];
// ---------------- Fetch user info ----------------
$stmt = $pdo->prepare("SELECT fullname FROM users WHERE id = ?");
$stmt->execute([$user_id]);
$user = $stmt->fetch(PDO::FETCH_ASSOC);
// ---------------- Fetch accounts ----------------
$stmt = $pdo->prepare("
SELECT id, account_number, currency, balance
FROM accounts
WHERE user_id = ?
");
$stmt->execute([$user_id]);
$accounts = $stmt->fetchAll(PDO::FETCH_ASSOC);
// ---------------- Fetch recent transactions (last 5) ----------------
$stmt = $pdo->prepare("
SELECT id, status, amount, from_account_id, to_account_id, metadata, created_at
FROM transactions
WHERE from_account_id IN (SELECT id FROM accounts WHERE user_id = ?)
OR to_account_id IN (SELECT id FROM accounts WHERE user_id = ?)
ORDER BY created_at DESC
LIMIT 5
");
$stmt->execute([$user_id, $user_id]);
$transactions = $stmt->fetchAll(PDO::FETCH_ASSOC);
// ---------------- Fetch messages (latest 5) ----------------
try {
$stmt = $pdo->prepare("
SELECT id, title, body, status, is_broadcast, created_at
FROM messages
WHERE user_id = ? OR is_broadcast = 1
ORDER BY created_at DESC
LIMIT 5
");
$stmt->execute([$user_id]);
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmtC = $pdo->prepare("
SELECT COUNT(*)
FROM messages
WHERE (user_id = ? OR is_broadcast = 1)
AND status <> 'seen'
");
$stmtC->execute([$user_id]);
$unreadMessages = (int)$stmtC->fetchColumn();
} catch (Exception $e) {
$messages = [];
$unreadMessages = 0;
}
// ---------------- Fetch notifications (latest 5) ----------------
try {
$stmt = $pdo->prepare("
SELECT id, title, body, status, created_at
FROM notifications
WHERE user_id = ? OR is_broadcast = 1
ORDER BY created_at DESC
LIMIT 5
");
$stmt->execute([$user_id]);
$notifications = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmtC = $pdo->prepare("
SELECT COUNT(*)
FROM notifications
WHERE (user_id = ? OR is_broadcast = 1)
AND status <> 'seen'
");
$stmtC->execute([$user_id]);
$unreadNotifs = (int)$stmtC->fetchColumn();
} catch (Exception $e) {
$notifications = [];
$unreadNotifs = 0;
}
// ---------------- Timezone (Auto) ----------------
if (!empty($_SESSION['timezone'])) {
date_default_timezone_set($_SESSION['timezone']);
} else {
date_default_timezone_set(ini_get('date.timezone') ?: 'UTC');
}
// ---------------- Greeting Logic ----------------
$hour = (int) date('H');
if ($hour < 12) $greet = "Good morning";
else if ($hour < 17) $greet = "Good afternoon";
else if ($hour < 21) $greet = "Good evening";
else $greet = "Good night";
$nameParts = explode(" ", trim($user['fullname']));
$firstName = ucfirst(strtolower($nameParts[0] ?? ''));
$greetingMessage = $greet . " " . $firstName;
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Chasedvault-style Dashboard — Demo</title>
<!-- Fonts & Icons -->
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="app" role="main" aria-label="Bank dashboard">
<!-- header Bar -->
<?php include "header.php" ?>
<!-- Accounts -->
<section class="accounts" style="font-family:'Segoe UI',sans-serif;color:#0c2340;">
<div class="hdr" style="font-weight:600;font-size:17px;margin-bottom:10px;">
Bank accounts (<?= count($accounts) ?>)
</div>
<div class="body">
<?php foreach ($accounts as $acc): ?>
<div class="account-row" style="display:flex;justify-content:space-between;align-items:center;padding:14px 0;border-bottom:1px solid #e5e8ec;">
<div>
<div class="acc-title" style="font-weight:600;font-size:15px;">
TOTAL CHECKING <?= htmlspecialchars($acc['account_number']) ?> (<?= $acc['currency'] ?>)
</div>
<div style="font-size:13px;color:#6b7280;margin-top:4px;">Available balance</div>
</div>
<div style="text-align:right;">
<div class="balance" style="font-size:20px;font-weight:600;color:#0c2340;display:flex;align-items:center;justify-content:flex-end;gap:8px;">
<?= $acc['currency'] ?>
<span class="hidden-balance" style="letter-spacing:2px;">••••••</span>
<span class="real-balance" style="display:none;"><?= number_format($acc['balance'], 2) ?></span>
<!-- Eye toggle -->
<button class="toggle-visibility"
style="background:none;border:none;cursor:pointer;outline:none;display:flex;align-items:center;">
<!-- Open eye -->
<svg class="eye-open" xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 24 24" stroke-width="1.7" stroke="#4b5563" width="22" height="22">
<path stroke-linecap="round" stroke-linejoin="round"
d="M2.036 12.322a1.012 1.012 0 010-.644
C3.423 7.51 7.36 4.5 12 4.5
c4.64 0 8.577 3.01 9.964 7.178
.07.204.07.44 0 .644
C20.577 16.49 16.64 19.5 12 19.5
c-4.64 0-8.577-3.01-9.964-7.178z" />
<path stroke-linecap="round" stroke-linejoin="round"
d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
<!-- Closed eye -->
<svg class="eye-closed" xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 24 24" stroke-width="1.7" stroke="#4b5563"
width="22" height="22" style="display:none;">
<path stroke-linecap="round" stroke-linejoin="round"
d="M3.98 8.223A10.477 10.477 0 001.934 12
c1.6 3.908 5.59 7 10.066 7
1.463 0 2.867-.293 4.156-.822M6.228 6.228
A10.45 10.45 0 0112 5
c4.477 0 8.466 3.092 10.066 7
a10.523 10.523 0 01-4.293 4.772M6.228 6.228
L3 3m3.228 3.228l3.65 3.65m7.894 7.894
L21 21m-3.228-3.228l-3.65-3.65
m0 0a3 3 0 10-4.243-4.243
m4.243 4.243L9.88 9.88" />
</svg>
</button>
</div>
<div style="font-size:12px;color:#6b7280;margin-top:4px;">Available balance</div>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="link-ext" style="margin-top:14px;color:#1a73e8;cursor:pointer;font-weight:500;">
Link external accounts
</div>
</section>
<script>
document.querySelectorAll('.toggle-visibility').forEach(btn => {
btn.addEventListener('click', () => {
const row = btn.closest('.account-row');
const hiddenBalance = row.querySelector('.hidden-balance');
const realBalance = row.querySelector('.real-balance');
const eyeOpen = btn.querySelector('.eye-open');
const eyeClosed = btn.querySelector('.eye-closed');
const isHidden = hiddenBalance.style.display !== 'none';
hiddenBalance.style.display = isHidden ? 'none' : 'inline';
realBalance.style.display = isHidden ? 'inline' : 'none';
eyeOpen.style.display = isHidden ? 'none' : 'inline';
eyeClosed.style.display = isHidden ? 'inline' : 'none';
// Add transition effect
[hiddenBalance, realBalance].forEach(el => {
el.style.transition = 'opacity 0.2s ease';
el.style.opacity = isHidden ? '1' : '0.7';
});
});
});
</script>
<!-- Explore Products -->
<h3 style="font-family: ui-sans-serif, system-ui, sans-serif; margin-top: 24px; margin-bottom: 12px; font-size: 1.125rem; /* 18px */ font-weight: 600; color: #1f2937; /* text-gray-800 */">Explore more products</h3>
<div class="products"
style="display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 12px; padding: 12px 2px; -webkit-overflow-scrolling: touch; scrollbar-width: thin;">
<a href="cards.php" class="product"
style="font-family: ui-sans-serif, system-ui, sans-serif; display: flex; align-items: center; gap: 12px; padding: 12px; background-color: #f9fafb; /* bg-gray-50 */ border: 1px solid #e5e7eb; /* border-gray-200 */ border-radius: 8px; /* rounded-lg */ text-decoration: none; color: #374151; /* text-gray-700 */ font-weight: 500; /* font-medium */
flex-shrink: 0; /* IMPORTANT: Prevents item from shrinking */
width: 250px; /* Sets a fixed width to ensure scrolling */"
onmouseover="this.style.backgroundColor='#f3f4f6' /* bg-gray-100 */"
onmouseout="this.style.backgroundColor='#f9fafb' /* bg-gray-50 */">
<div class="p-ico" style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 9999px; /* rounded-full */ background-color: #dbeafe; /* bg-blue-100 */ color: #1d4ed8; /* text-blue-700 */ font-weight: 600; font-size: 0.875rem; /* text-sm */">C</div>
<div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">Credit cards</div>
</a>
<a href="check.php" class="product"
style="font-family: ui-sans-serif, system-ui, sans-serif; display: flex; align-items: center; gap: 12px; padding: 12px; background-color: #f9fafb; /* bg-gray-50 */ border: 1px solid #e5e7eb; /* border-gray-200 */ border-radius: 8px; /* rounded-lg */ text-decoration: none; color: #374151; /* text-gray-700 */ font-weight: 500; /* font-medium */
flex-shrink: 0; /* IMPORTANT: Prevents item from shrinking */
width: 250px; /* Sets a fixed width to ensure scrolling */"
onmouseover="this.style.backgroundColor='#f3f4f6' /* bg-gray-100 */"
onmouseout="this.style.backgroundColor='#f9fafb' /* bg-gray-50 */">
<div class="p-ico" style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 9999px; /* rounded-full */ background-color: #dcfce7; /* bg-green-100 */ color: #15803d; /* text-green-700 */ font-weight: 600; font-size: 0.875rem; /* text-sm */">CK</div>
<div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">Checking</div>
</a>
<a href="savings.php" class="product"
style="font-family: ui-sans-serif, system-ui, sans-serif; display: flex; align-items: center; gap: 12px; padding: 12px; background-color: #f9fafb; /* bg-gray-50 */ border: 1px solid #e5e7eb; /* border-gray-200 */ border-radius: 8px; /* rounded-lg */ text-decoration: none; color: #374151; /* text-gray-700 */ font-weight: 500; /* font-medium */
flex-shrink: 0; /* IMPORTANT: Prevents item from shrinking */
width: 250px; /* Sets a fixed width to ensure scrolling */"
onmouseover="this.style.backgroundColor='#f3f4f6' /* bg-gray-100 */"
onmouseout="this.style.backgroundColor='#f9fafb' /* bg-gray-50 */">
<div class="p-ico" style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 9999px; /* rounded-full */ background-color: #e0e7ff; /* bg-indigo-100 */ color: #4338ca; /* text-indigo-700 */ font-weight: 600; font-size: 0.875rem; /* text-sm */">S</div>
<div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">Savings & CDs</div>
</a>
<a href="business.php" class="product"
style="font-family: ui-sans-serif, system-ui, sans-serif; display: flex; align-items: center; gap: 12px; padding: 12px; background-color: #f9fafb; /* bg-gray-50 */ border: 1px solid #e5e7eb; /* border-gray-200 */ border-radius: 8px; /* rounded-lg */ text-decoration: none; color: #374151; /* text-gray-700 */ font-weight: 500; /* font-medium */
flex-shrink: 0; /* IMPORTANT: Prevents item from shrinking */
width: 250px; /* Sets a fixed width to ensure scrolling */"
onmouseover="this.style.backgroundColor='#f3f4f6' /* bg-gray-100 */"
onmouseout="this.style.backgroundColor='#f9fafb' /* bg-gray-50 */">
<div class="p-ico" style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 9999px; /* rounded-full */ background-color: #fef3c7; /* bg-amber-100 */ color: #b45309; /* text-amber-700 */ font-weight: 600; font-size: 0.875rem; /* text-sm */">B</div>
<div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">Business</div>
</a>
<a href="mailto:support@Chasedvault.com" class="product"
style="font-family: ui-sans-serif, system-ui, sans-serif; display: flex; align-items: center; gap: 12px; padding: 12px; background-color: #f9fafb; /* bg-gray-50 */ border: 1px solid #e5e7eb; /* border-gray-200 */ border-radius: 8px; /* rounded-lg */ text-decoration: none; color: #374151; /* text-gray-700 */ font-weight: 500; /* font-medium */
flex-shrink: 0; /* IMPORTANT: Prevents item from shrinking */
width: 250px; /* Sets a fixed width to ensure scrolling */"
onmouseover="this.style.backgroundColor='#f3f4f6' /* bg-gray-100 */"
onmouseout="this.style.backgroundColor='#f9fafb' /* bg-gray-50 */">
<div class="p-ico" style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 9999px; /* rounded-full */ background-color: #f3e8ff; /* bg-purple-100 */ color: #7e22ce; /* text-purple-700 */ font-weight: 600; font-size: 0.875rem; /* text-sm */">A</div>
<div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">Work with our advisors</div>
</a>
</div>
<div class="explore-cta" style="margin-top: 24px;">
<a href="products.php" style="text-decoration: none;">
<button class="explore-btn"
style="font-family: ui-sans-serif, system-ui, sans-serif; width: 100%; padding: 12px 20px; background-color: #2563eb; /* bg-blue-600 */ color: white; font-weight: 600; /* font-semibold */ font-size: 0.875rem; /* text-sm */ border: none; border-radius: 8px; /* rounded-lg */ cursor: pointer;"
onmouseover="this.style.backgroundColor='#1d4ed8' /* bg-blue-700 */"
onmouseout="this.style.backgroundColor='#2563eb' /* bg-blue-600 */">
Explore products
</button>
</a>
</div>
<br>
<br>
<h2 style="
font-family: ui-sans-serif, system-ui, sans-serif;
color: #1f2937; /* text-gray-800 */
font-weight: 600; /* font-semibold */
font-size: 1.125rem; /* 18px / text-lg */
margin-top: 24px; /* mt-6 */
margin-bottom: 16px; /* mb-4 */
border-bottom: 1px solid #e5e7eb; /* border-b border-gray-200 */
padding-bottom: 8px; /* pb-2 */
">
Recent Transactions
</h2>
<div class="explore-cta" style="margin-bottom: 16px; /* mb-4 */">
<a href="transactions.php" style="text-decoration: none;">
<button class="explore-btn"
style="font-family: ui-sans-serif, system-ui, sans-serif; width: 100%; padding: 10px 16px; /* py-2.5 px-4 */ background-color: #2563eb; /* bg-blue-600 */ color: white; font-weight: 600; /* font-semibold */ font-size: 0.875rem; /* text-sm */ border: none; border-radius: 8px; /* rounded-lg */ cursor: pointer;"
onmouseover="this.style.backgroundColor='#1d4ed8' /* bg-blue-700 */"
onmouseout="this.style.backgroundColor='#2563eb' /* bg-blue-600 */">
Browse All Transactions
</button>
</a>
</div>
<table style="
width: 100%;
border-collapse: collapse;
font-family: ui-sans-serif, system-ui, sans-serif;
background: #ffffff;
border-radius: 8px; /* rounded-lg */
overflow: hidden;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1); /* shadow */
">
<thead style="
background: #f9fafb; /* bg-gray-50 */
color: #6b7280; /* text-gray-500 */
font-size: 0.75rem; /* 12px / text-xs */
text-transform: uppercase;
letter-spacing: 0.05em; /* tracking-wider */
">
<tr>
<th style="text-align: left; padding: 12px 16px; /* py-3 px-4 */ font-weight: 500; /* font-medium */">Description</th>
<th style="text-align: center; padding: 12px 16px; /* py-3 px-4 */ font-weight: 500; /* font-medium */">Amount</th> <th style="text-align: center; padding: 12px 16px; /* py-3 px-4 */ font-weight: 500; /* font-medium */">Status</th>
<th style="text-align: center; padding: 12px 16px; /* py-3 px-4 */ font-weight: 500; /* font-medium */">Date</th> </tr>
</thead>
<tbody>
<?php if($transactions): ?>
<?php foreach($transactions as $t): ?>
<?php
$meta = json_decode($t['metadata'] ?? "{}", true);
$desc = $meta['narration'] ?? ($meta['description'] ?? "Transaction");
$isDebit = ($t['from_account_id'] !== null && in_array($t['from_account_id'], array_column($accounts, 'id')));
?>
<tr style="
border-bottom: 1px solid #e5e7eb; /* border-b border-gray-200 */
transition: background 0.2s ease;
cursor: default;
" onmouseover="this.style.backgroundColor='#f9fafb' /* bg-gray-50 */" onmouseout="this.style.backgroundColor='transparent'">
<td style="padding: 16px 16px; /* py-4 px-4 */ color: #374151; /* text-gray-700 */ font-size: 0.875rem; /* text-sm */">
<?= htmlspecialchars($desc) ?>
</td>
<td style="padding: 16px 16px; /* py-4 px-4 */ text-align: center; font-weight: 600; /* font-semibold */ color: <?= $isDebit ? '#dc2626' : '#16a34a' ?>; /* text-red-600 / text-green-600 */
font-size: 0.875rem; /* text-sm */">
<?= $isDebit ? '-' : '+' ?><?= number_format($t['amount'], 2) ?>
</td>
<td style="padding: 16px 16px; /* py-4 px-4 */ text-align: center;">
<?php
$status = ucfirst($t['status']);
$colors = match(strtolower($t['status'])) {
'pending' => ['bg' => '#fef3c7', 'text' => '#b45309'], /* bg-yellow-100, text-yellow-700 */
'completed' => ['bg' => '#dcfce7', 'text' => '#15803d'], /* bg-green-100, text-green-700 */
'failed' => ['bg' => '#fee2e2', 'text' => '#b91c1c'], /* bg-red-100, text-red-700 */
default => ['bg' => '#f1f5f9', 'text' => '#475569'], /* bg-slate-100, text-slate-600 */
};
?>
<span style="
background: <?= $colors['bg'] ?>;
color: <?= $colors['text'] ?>;
padding: 4px 12px; /* py-1 px-3 */
border-radius: 9999px; /* rounded-full */
font-size: 0.75rem; /* 12px / text-xs */
font-weight: 600; /* font-semibold */
"><?= $status ?></span>
</td>
<td style="padding: 16px 16px; /* py-4 px-4 */ text-align: center; color: #6b7280; /* text-gray-500 */ font-size: 0.875rem; /* text-sm */"> <?= date("M d, Y", strtotime($t['created_at'])) ?>
</td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="4" style="
text-align: center;
color: #9ca3af; /* text-gray-400 */
padding: 24px 16px; /* py-6 px-4 */
font-size: 0.875rem; /* text-sm */
">
No transactions yet
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<br>
<br>
</main>
<!-- Bottom Navigation -->
<?php include "nav.php" ?>
</body>
</html>
b IDATxytVսϓ22 A@IR:hCiZ[v*E:WũZA ^dQeQ @ !jZ'>gsV仿$|?g)&x-E