-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
executable file
·92 lines (79 loc) · 3.01 KB
/
profile.php
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
include("php/connect.php");
session_start();
// Check if user is logged in
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
// Fetch user data from the database based on session ID
$user_id = $_SESSION['user_id'];
$sql = "SELECT username, email, role FROM users WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $user_id);
$stmt->execute();
$result = $stmt->get_result();
$user = $result->fetch_assoc();
if (!$user) {
echo "User not found.";
exit();
}
$username = $user['username'];
$email = $user['email'];
$role = $user['role'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo ucfirst($role); ?> Profile - TeenZee</title>
<link rel="stylesheet" href="style/style.css">
<!-- Add icon library -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<!-- Profile Page -->
<header>
<h1><?php echo ucfirst($role); ?> Profile</h1>
<p>Welcome, <?php echo $username; ?>!</p>
<nav>
<a href="home.html">Home</a>
<a href="logout.php">Logout</a>
</nav>
</header>
<main>
<!-- Display a different profile section based on the role -->
<?php if ($role === 'student'): ?>
<section class="student-profile">
<h2>Student Dashboard</h2>
<p>Email: <?php echo $email; ?></p>
<p>Find resources tailored to help you in your studies and career path.</p>
<!-- Add specific content for students here -->
<a href="resources.php">View Resources</a>
</section>
<?php elseif ($role === 'mentor'): ?>
<section class="mentor-profile">
<h2>Mentor Dashboard</h2>
<p>Email: <?php echo $email; ?></p><br>
<p >Help students navigate their career by providing mentorship and guidance.</p>
<!-- Add specific content for mentors here -->
<a href="mentor-resources.php">Mentor Resources</a>
</section>
<?php endif; ?>
</main>
<div class="space"></div>
<footer>
<p>Follow us on social media:</p>
<ul>
<li><a href="https://www.facebook.com/victor chibuike" target="_blank">Facebook</a></li>
<li><a href="https://www.instagram.com" target="_blank">Instagram</a></li>
<li><a href="https://www.twitter.com/viktor chibuike" target="_blank">X (Twitter)</a></li>
<li><a href="mailto:support@teenzee.com">Email Us</a></li>
</ul>
<p>© 2024 TeenZee. All rights reserved.</p>
</footer>
</body>
</html>