PNG IHDR x sBIT|d pHYs + tEXtSoftware www.inkscape.org< ,tEXtComment
<?php
// 🔴 DEBUG MODE ON
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
session_start();
// 1. Ensure the user is logged in
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
$userId = $_SESSION['user_id'];
// 2. Database Configuration
$host = 'localhost';
$dbname = 'u264723324_C1Vdb';
$user = 'u264723324_C1Vun';
$pass = '@RTdAq123&a';
try {
$pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8mb4", $user, $pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// =======================================================
// LIVE QUERY: Fetch User Status for Security/Restrictions
// =======================================================
$stmtUser = $pdo->prepare("SELECT first_name, last_name, kyc_status, access_status, block_reason FROM users WHERE id = ? LIMIT 1");
$stmtUser->execute([$userId]);
$userRow = $stmtUser->fetch(PDO::FETCH_ASSOC);
if (!$userRow) {
session_destroy();
header("Location: login.php");
exit();
}
$kyc_status = $userRow['kyc_status'];
$access_status = $userRow['access_status'] ?? 'active';
$block_reason = $userRow['block_reason'] ?? 'Please contact support.';
$firstName = $userRow['first_name'];
// =======================================================
// AJAX HANDLER: SUBMIT TAX REFUND
// =======================================================
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['ajax_action'])) {
ob_clean();
header('Content-Type: application/json');
if ($_POST['ajax_action'] === 'file_tax') {
$taxYear = filter_input(INPUT_POST, 'tax_year', FILTER_VALIDATE_INT);
$income = filter_input(INPUT_POST, 'declared_income', FILTER_VALIDATE_FLOAT);
$refund = filter_input(INPUT_POST, 'requested_refund', FILTER_VALIDATE_FLOAT);
// Validation
if (!$taxYear || $taxYear < 2000 || $taxYear > date("Y")) {
echo json_encode(['success' => false, 'message' => 'Invalid Tax Year.']);
exit;
}
if (!$income || $income < 0) {
echo json_encode(['success' => false, 'message' => 'Declared income is required.']);
exit;
}
if (!$refund || $refund <= 0 || $refund > $income) {
echo json_encode(['success' => false, 'message' => 'Refund amount must be valid and cannot exceed declared income.']);
exit;
}
// Check if user already filed for this specific year
$stmtCheck = $pdo->prepare("SELECT id FROM tax_refunds WHERE user_id = ? AND tax_year = ?");
$stmtCheck->execute([$userId, $taxYear]);
if ($stmtCheck->fetch()) {
echo json_encode(['success' => false, 'message' => "You have already filed a return for the year $taxYear."]);
exit;
}
try {
// Insert Tax Filing into database
$stmt = $pdo->prepare("INSERT INTO tax_refunds (user_id, tax_year, declared_income, requested_refund, status, created_at) VALUES (?, ?, ?, ?, 'pending', NOW())");
$stmt->execute([$userId, $taxYear, $income, $refund]);
echo json_encode(['success' => true, 'message' => 'Tax Return submitted successfully!']);
} catch (Exception $e) {
echo json_encode(['success' => false, 'message' => 'Database error: ' . $e->getMessage()]);
}
exit;
}
}
// =======================================================
// FETCH USER'S TAX HISTORY
// =======================================================
$stmtTaxes = $pdo->prepare("SELECT * FROM tax_refunds WHERE user_id = ? ORDER BY tax_year DESC, created_at DESC");
$stmtTaxes->execute([$userId]);
$taxRecords = $stmtTaxes->fetchAll(PDO::FETCH_ASSOC);
// Find if there's a pending refund to show in the Hero section
$pendingRefundAmount = 0.00;
$pendingYear = date("Y") - 1;
foreach ($taxRecords as $t) {
if ($t['status'] === 'pending') {
$pendingRefundAmount = $t['requested_refund'];
$pendingYear = $t['tax_year'];
break;
}
}
} catch (PDOException $e) {
$dbError = "Connection error. Please try again later.";
$taxRecords = [];
$pendingRefundAmount = 0.00;
$pendingYear = date("Y") - 1;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tax Refunds - Capitalvalts</title>
<style>
:root { --bg-dark: #0a0e17; --surface-dark: #131a2a; --surface-light: #1e2738; --accent-blue: #0ea5e9; --text-main: #f8fafc; --text-muted: #94a3b8; --success: #22c55e; --danger: #ef4444; --warning: #facc15;}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
body { background-color: var(--bg-dark); color: var(--text-main); }
.app-container { display: flex; flex-direction: column; min-height: 100vh; }
.sidebar { display: none; }
.main-content { flex: 1; padding: 20px; padding-bottom: 90px; }
.top-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.back-btn { background: var(--surface-dark); border: 1px solid rgba(255,255,255,0.05); color: var(--text-main); font-size: 1.5rem; cursor: pointer; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; transition: 0.2s;}
.back-btn:active { transform: scale(0.95); }
.page-title { font-size: 1.5rem; font-weight: 700; }
.section-header { font-size: 1.1rem; font-weight: 600; margin-bottom: 16px; margin-top: 24px;}
.card { background: var(--surface-dark); border-radius: 16px; padding: 20px; border: 1px solid rgba(255,255,255,0.05); margin-bottom: 16px; }
.refund-hero { text-align: center; background: linear-gradient(135deg, #0284c7, #0f172a); border-radius: 16px; padding: 32px 20px; margin-bottom: 24px; border: 1px solid rgba(255,255,255,0.1); }
.refund-hero p { color: rgba(255,255,255,0.8); font-size: 0.9rem; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1px;}
.refund-hero h1 { font-size: 2.5rem; color: white; margin-bottom: 16px;}
.upload-box { border: 2px dashed rgba(255,255,255,0.2); border-radius: 12px; padding: 32px 16px; text-align: center; cursor: pointer; transition: 0.2s; background: rgba(255,255,255,0.02);}
.upload-box:active { background: rgba(14, 165, 233, 0.1); border-color: var(--accent-blue); }
.upload-icon { font-size: 2rem; margin-bottom: 12px; color: var(--accent-blue); }
.timeline-item { display: flex; gap: 16px; margin-bottom: 20px; position: relative;}
.timeline-item::after { content: ''; position: absolute; left: 11px; top: 30px; bottom: -20px; width: 2px; background: rgba(255,255,255,0.1); }
.timeline-item:last-child::after { display: none; }
.timeline-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-light); border: 2px solid var(--accent-blue); display: flex; align-items: center; justify-content: center; z-index: 1; font-size: 0.7rem; font-weight: bold;}
.timeline-dot.done { background: var(--success); border-color: var(--success); color: white;}
.timeline-dot.pending { background: var(--warning); border-color: var(--warning); color: var(--bg-dark);}
.timeline-dot.rejected { background: var(--danger); border-color: var(--danger); color: white;}
.timeline-content { flex: 1; }
.timeline-content h4 { font-size: 0.95rem; margin-bottom: 4px; display: flex; justify-content: space-between; }
.timeline-content p { font-size: 0.8rem; color: var(--text-muted); }
.timeline-amt { font-family: monospace; font-weight: bold; color: var(--text-main); }
.primary-btn { width: 100%; background: var(--accent-blue); color: white; border: none; padding: 16px; border-radius: 12px; font-size: 1rem; font-weight: 600; cursor: pointer; margin-top: 16px; transition: 0.2s;}
.primary-btn:active { transform: scale(0.98); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* MODALS */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); display: flex; align-items: flex-end; justify-content: center; opacity: 0; pointer-events: none; transition: 0.3s ease-in-out; z-index: 1000; }
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-container { background: var(--surface-dark); width: 100%; max-width: 500px; border-radius: 24px 24px 0 0; padding: 24px; transform: translateY(100%); transition: 0.3s ease-in-out; border-top: 1px solid rgba(255,255,255,0.05); max-height: 90vh; overflow-y: auto;}
.modal-overlay.active .modal-container { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-header h3 { font-size: 1.2rem; }
.close-btn { background: rgba(255,255,255,0.1); border: none; color: white; width: 30px; height: 30px; border-radius: 50%; font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.modal-subtitle { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 24px; line-height: 1.4; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; font-weight: 600;}
.form-input { width: 100%; background: var(--bg-dark); border: 1px solid rgba(255,255,255,0.1); color: var(--text-main); padding: 16px; border-radius: 12px; font-size: 1rem; outline: none; transition: 0.2s; }
.form-input:focus { border-color: var(--accent-blue); }
.currency-input { position: relative; display: flex; align-items: center; background: var(--bg-dark); border-radius: 12px; padding: 0 16px; border: 1px solid rgba(255,255,255,0.1); margin-bottom: 16px;}
.currency-input span { font-size: 1.2rem; color: var(--text-muted); }
.currency-input input { background: transparent; border: none; color: white; font-size: 1.2rem; padding: 16px 8px; width: 100%; outline: none; }
.toast { position: fixed; top: -100px; left: 50%; transform: translateX(-50%); background: var(--success); color: white; padding: 12px 24px; border-radius: 30px; font-size: 0.9rem; font-weight: 600; transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 2000; box-shadow: 0 5px 15px rgba(0,0,0,0.4); text-align: center; width: max-content; max-width: 90vw;}
.toast.show { top: 40px; }
.toast.error { background: var(--danger); }
.bottom-nav { position: fixed; bottom: 0; width: 100%; background: rgba(19, 26, 42, 0.95); backdrop-filter: blur(10px); display: flex; justify-content: space-around; padding: 12px 0 24px 0; border-top: 1px solid rgba(255,255,255,0.05); }
.nav-item { display: flex; flex-direction: column; align-items: center; color: var(--text-muted); text-decoration: none; font-size: 0.7rem; gap: 4px; }
@media (min-width: 1024px) {
.app-container { flex-direction: row; }
.bottom-nav { display: none; }
.sidebar { display: flex; flex-direction: column; width: 260px; background: var(--surface-dark); border-right: 1px solid rgba(255,255,255,0.05); padding: 32px 24px; height: 100vh; position: sticky; top: 0; }
.sidebar .logo { font-size: 1.5rem; font-weight: bold; margin-bottom: 48px; color: var(--accent-blue); }
.side-nav { display: flex; flex-direction: column; gap: 12px; }
.side-nav a { color: var(--text-muted); text-decoration: none; padding: 12px 16px; border-radius: 12px; transition: 0.2s; display: flex; align-items: center; gap: 12px; }
.side-nav a:hover { background: rgba(14, 165, 233, 0.1); color: var(--accent-blue); }
.main-content { padding: 40px 60px; max-width: 800px; margin: 0 auto; }
.back-btn { display: none; }
.modal-overlay { align-items: center; }
.modal-container { border-radius: 24px; border: 1px solid rgba(255,255,255,0.1); }
}
</style>
</head>
<body>
<?php if ($access_status === 'blocked' || $kyc_status === 'pending' || $kyc_status === 'rejected'): ?>
<style>
body { overflow: hidden !important; }
.restriction-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(10, 14, 23, 0.85); backdrop-filter: blur(12px); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px;}
.restriction-box { background: var(--surface-dark); border: 1px solid rgba(255,255,255,0.1); padding: 40px; border-radius: 24px; text-align: center; max-width: 450px; box-shadow: 0 20px 50px rgba(0,0,0,0.8);}
.restriction-icon { font-size: 3rem; margin-bottom: 16px; }
.restriction-box h2 { margin-bottom: 12px; color: var(--text-main); font-size: 1.5rem;}
.restriction-box p { color: var(--text-muted); font-size: 0.95rem; line-height: 1.6; margin-bottom: 24px;}
.logout-btn-large { display: inline-block; width: 100%; background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); padding: 16px; border-radius: 12px; text-decoration: none; font-weight: 600; transition: 0.2s;}
.logout-btn-large:active { transform: scale(0.98); background: rgba(239, 68, 68, 0.2); }
</style>
<div class="restriction-overlay">
<div class="restriction-box">
<?php if ($access_status === 'blocked'): ?>
<div class="restriction-icon">🔒</div>
<h2>Account Suspended</h2>
<p><?php echo htmlspecialchars($block_reason); ?></p>
<?php elseif ($kyc_status === 'pending'): ?>
<div class="restriction-icon">⏳</div>
<h2>Account Under Review</h2>
<p>Welcome, <?php echo htmlspecialchars($firstName); ?>! Your account has been created successfully. For your security, our compliance team is reviewing your details.</p>
<?php else: ?>
<div class="restriction-icon">🚫</div>
<h2>Account Restricted</h2>
<p>Your application could not be verified. Please contact Capitalvalts support for further assistance.</p>
<?php endif; ?>
<a href="logout.php" class="logout-btn-large">Sign Out</a>
</div>
</div>
<?php endif; ?>
<div id="toast" class="toast">Action Successful!</div>
<div class="app-container">
<aside class="sidebar">
<div class="logo">Capitalvalts</div>
<nav class="side-nav">
<a href="index.php"><span>🏠</span> Home</a>
<a href="activity.php"><span>📊</span> Activity</a>
<a href="transfer.php"><span>💸</span> Transfer</a>
<a href="cards.php"><span>💳</span> Cards</a>
<a href="profile.php"><span>👤</span> Profile</a>
</nav>
</aside>
<main class="main-content">
<header class="top-header">
<button class="back-btn" onclick="window.location.href='index.php'">←</button>
<h1 class="page-title">Tax Center</h1>
</header>
<div class="refund-hero">
<?php if ($pendingRefundAmount > 0): ?>
<p>Pending <?php echo $pendingYear; ?> Tax Refund</p>
<h1>$<?php echo number_format($pendingRefundAmount, 2); ?></h1>
<button style="background: white; color: var(--bg-dark); border: none; padding: 10px 20px; border-radius: 8px; font-weight: bold; cursor: pointer; opacity: 0.5;" disabled>Under Audit</button>
<?php else: ?>
<p>Estimated <?php echo $pendingYear; ?> Tax Refund</p>
<h1>$0.00</h1>
<button style="background: white; color: var(--bg-dark); border: none; padding: 10px 20px; border-radius: 8px; font-weight: bold; cursor: pointer;" onclick="openTaxModal()">File Return Now</button>
<?php endif; ?>
</div>
<h3 class="section-header">File Your Taxes</h3>
<div class="card">
<div class="upload-box" onclick="openTaxModal()">
<div class="upload-icon">📄</div>
<h4 style="margin-bottom: 4px;">Upload W-2 or 1099</h4>
<p style="font-size: 0.8rem; color: var(--text-muted);">Tap to securely input your tax declaration details.</p>
</div>
<button class="primary-btn" onclick="openTaxModal()">Start Filing</button>
</div>
<h3 class="section-header">Past Filings</h3>
<div class="card">
<?php if (empty($taxRecords)): ?>
<div style="text-align:center; padding: 20px; color: var(--text-muted); font-style: italic;">
No past tax filings found on record.
</div>
<?php else: ?>
<?php foreach ($taxRecords as $tax):
$icon = '✓'; $dotClass = 'done'; $statusText = 'Accepted and Processed';
if ($tax['status'] === 'pending') {
$icon = '⏳'; $dotClass = 'pending'; $statusText = 'Awaiting IRS Verification';
} elseif ($tax['status'] === 'rejected') {
$icon = '✕'; $dotClass = 'rejected'; $statusText = 'Return Rejected / Audited';
}
?>
<div class="timeline-item">
<div class="timeline-dot <?php echo $dotClass; ?>"><?php echo $icon; ?></div>
<div class="timeline-content">
<h4>
<?php echo htmlspecialchars($tax['tax_year']); ?> Tax Return
<span class="timeline-amt">$<?php echo number_format($tax['requested_refund'], 2); ?></span>
</h4>
<p><?php echo $statusText; ?></p>
<?php if ($tax['status'] === 'approved'): ?>
<a href="#" style="font-size: 0.75rem; color: var(--accent-blue); text-decoration: none; display: inline-block; margin-top: 4px;">Download Receipt (PDF)</a>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</main>
<nav class="bottom-nav">
<a href="activity.php" class="nav-item"><span class="nav-icon">📊</span>Activity</a>
<a href="transfer.php" class="nav-item"><span class="nav-icon">💸</span>Transfer</a>
<a href="index.php" class="nav-item"><span class="nav-icon">🏠</span>Home</a>
<a href="cards.php" class="nav-item"><span class="nav-icon">💳</span>Cards</a>
<a href="profile.php" class="nav-item"><span class="nav-icon">👤</span>Profile</a>
</nav>
</div>
<div class="modal-overlay" id="taxModal">
<div class="modal-container">
<div class="modal-header">
<h3>File Tax Return</h3>
<button class="close-btn" onclick="closeModal('taxModal')">×</button>
</div>
<p class="modal-subtitle">Declare your income to claim your refund.</p>
<form id="taxForm" onsubmit="submitTaxFiling(event)">
<div class="form-group">
<label class="form-label">Tax Year</label>
<input type="number" id="taxYear" class="form-input" value="<?php echo date('Y') - 1; ?>" max="<?php echo date('Y'); ?>" min="2000" required>
</div>
<label class="form-label">Total Declared Income</label>
<div class="currency-input">
<span>$</span>
<input type="number" id="decIncome" placeholder="0.00" min="1" step="0.01" required>
</div>
<label class="form-label">Expected Refund Amount</label>
<div class="currency-input">
<span>$</span>
<input type="number" id="reqRefund" placeholder="0.00" min="1" step="0.01" required>
</div>
<div style="background: rgba(255,255,255,0.02); padding: 16px; border-radius: 12px; margin-bottom: 24px; border: 1px dashed rgba(255,255,255,0.1);">
<p style="font-size: 0.75rem; color: var(--text-muted); line-height: 1.5;">* Under penalty of perjury, I declare that I have examined this return, and to the best of my knowledge and belief, it is true, correct, and complete.</p>
</div>
<button type="submit" class="primary-btn" id="submitBtn">Transmit to IRS Gateway</button>
</form>
</div>
</div>
<script>
function showToast(message, isError = false) {
const toast = document.getElementById('toast');
toast.textContent = message;
toast.className = 'toast show ' + (isError ? 'error' : '');
setTimeout(() => { toast.classList.remove('show'); }, 3000);
}
const modal = document.getElementById('taxModal');
function openTaxModal() {
modal.classList.add('active');
}
function closeModal(modalId) {
document.getElementById(modalId).classList.remove('active');
}
modal.addEventListener('click', (e) => {
if (e.target === modal) {
closeModal('taxModal');
}
});
function submitTaxFiling(event) {
event.preventDefault();
const year = document.getElementById('taxYear').value;
const income = document.getElementById('decIncome').value;
const refund = document.getElementById('reqRefund').value;
const btn = document.getElementById('submitBtn');
if(parseFloat(refund) > parseFloat(income)) {
showToast("Refund cannot exceed declared income.", true);
return;
}
btn.disabled = true;
btn.innerText = "Transmitting...";
const formData = new FormData();
formData.append('ajax_action', 'file_tax');
formData.append('tax_year', year);
formData.append('declared_income', income);
formData.append('requested_refund', refund);
fetch('tax.php', {
method: 'POST',
body: formData
})
.then(async r => {
const text = await r.text();
try { return JSON.parse(text); }
catch(e) { throw new Error(text); }
})
.then(data => {
if(data.success) {
showToast(data.message);
closeModal('taxModal');
setTimeout(() => location.reload(), 1500);
} else {
showToast(data.message, true);
btn.disabled = false;
btn.innerText = "Transmit to IRS Gateway";
}
})
.catch(err => {
console.error(err);
showToast("Connection error. Try again.", true);
btn.disabled = false;
btn.innerText = "Transmit to IRS Gateway";
});
}
</script>
</body>
</html>
b IDATxytVսϓ22 A@IR:hCiZ[v*E:WũZA ^dQeQ @ !jZ'>gsV仿$|?g)&x-E