-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.php
More file actions
54 lines (49 loc) · 1.49 KB
/
dashboard.php
File metadata and controls
54 lines (49 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
session_start();
if (!isset($_SESSION['user_id'])) {
header("Location: login.php"); // If user is not logged in, redirect to login page
exit();
}
include('db.php');
$user_id = $_SESSION['user_id'];
$sql = "SELECT * FROM users WHERE id='$user_id'";
$result = $conn->query($sql);
$user = $result->fetch_assoc();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- Header Section -->
<header>
<div class="logo">
<a href="index.php"> <img src="logo.png" alt="Creativity Freaks Logo" height="30"> </a>
</div>
<nav>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="profile.php">Profile</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</nav>
</header>
<main>
<h1>Welcome, <?php echo $user['username']; ?>!</h1>
<p>Explore courses, update your profile, or logout.</p>
<div class="dashboard-options">
<a href="courses.php">Browse Courses</a>
<a href="profile.php">Edit Profile</a>
</div>
</main>
<footer>
<p>© 2025 Creativity Freaks. All rights reserved.</p>
</footer>
<script src="script.js"></script>
</body>
</html>
<?php include('footer.php'); ?>