| Server IP : 127.0.0.1 / Your IP : 216.73.216.48 Web Server : Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12 System : Windows NT DESKTOP-3H4FHQJ 10.0 build 19045 (Windows 10) AMD64 User : win 10 ( 0) PHP Version : 8.2.12 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/xampp/htdocs-coblaa/Cinevaa/ |
Upload File : |
<?php
include('db.php');
session_start();
// 1. Protection: If not logged in, send to login page
if (!isset($_SESSION['my_id'])) {
header("Location: login.php");
exit();
}
$user_id = $_SESSION['my_id'];
$username = $_SESSION['username'] ?? 'Student';
// 2. Check Payment Status from Database
$is_paid = false;
$plan_type = "No Active Plan";
$query = "SELECT status, plan FROM payments WHERE user_id = '$user_id' AND status = 'approved' ORDER BY created_at DESC LIMIT 1";
$result = mysqli_query($con, $query);
if ($row = mysqli_fetch_assoc($result)) {
$is_paid = true;
$plan_type = $row['plan'] . " Plan";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Dashboard</title>
<style>
:root {
--primary: #2563eb;
--success: #10b981;
--bg: #f3f4f6;
--card-bg: #ffffff;
--text-dark: #1f2937;
}
body {
font-family: 'Inter', sans-serif;
background-color: var(--bg);
margin: 0;
display: flex;
}
/* Sidebar Navigation */
.sidebar {
width: 260px;
background: #1e293b;
color: white;
min-height: 100vh;
padding: 20px;
box-sizing: border-box;
}
.main-content {
flex: 1;
padding: 40px;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
}
/* Status Badges */
.badge {
padding: 5px 12px;
border-radius: 20px;
font-size: 0.8rem;
font-weight: bold;
}
.badge-paid { background: #dcfce7; color: #166534; }
.badge-unpaid { background: #fee2e2; color: #991b1b; }
/* Dashboard Grid */
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, min-minmax(300px, 1fr));
gap: 20px;
}
.card {
background: var(--card-bg);
padding: 24px;
border-radius: 12px;
box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}
.locked {
filter: blur(2px);
pointer-events: none;
opacity: 0.6;
}
.unlock-overlay {
background: rgba(255, 255, 255, 0.9);
border: 2px dashed var(--primary);
text-align: center;
padding: 20px;
border-radius: 12px;
margin-top: 10px;
}
.btn {
background: var(--primary);
color: white;
padding: 10px 20px;
text-decoration: none;
border-radius: 6px;
display: inline-block;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="sidebar">
<h2>EduPortal</h2>
<p style="color: #94a3b8;">Welcome, <?php echo htmlspecialchars($username); ?></p>
<hr style="border-color: #334155;">
<nav>
<p>🏠 Dashboard</p>
<p>📚 My Courses</p>
<p>⚙️ Settings</p>
<p><a href="logout.php" style="color: #ef4444; text-decoration: none;">Logout</a></p>
</nav>
</div>
<div class="main-content">
<div class="header">
<h1>Student Dashboard</h1>
<span class="badge <?php echo $is_paid ? 'badge-paid' : 'badge-unpaid'; ?>">
<?php echo $is_paid ? '● Active: ' . $plan_type : '● Account Inactive'; ?>
</span>
</div>
<div class="grid">
<div class="card">
<h3>Course Progress</h3>
<p>You have completed 0/12 lessons.</p>
<div style="background: #e5e7eb; height: 10px; border-radius: 5px;">
<div style="background: var(--primary); width: 5%; height: 100%; border-radius: 5px;"></div>
</div>
</div>
<div class="card">
<h3>Premium Resources</h3>
<?php if ($is_paid): ?>
<ul style="line-height: 2;">
<li>✅ Download PDF Notes</li>
<li>✅ Video Tutorials</li>
<li>✅ Exam Practice Sheets</li>
</ul>
<a href="resources.php" class="btn">Access Now</a>
<?php else: ?>
<div class="locked">
<ul>
<li>Download PDF Notes</li>
<li>Video Tutorials</li>
</ul>
</div>
<div class="unlock-overlay">
<p>Unlock Premium content to start learning.</p>
<a href="payment_page.php" class="btn">Upgrade Now</a>
</div>
<?php endif; ?>
</div>
</div>
</div>
</body>
</html>