-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser_profile.php
More file actions
54 lines (51 loc) · 1.87 KB
/
user_profile.php
File metadata and controls
54 lines (51 loc) · 1.87 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'])) {
header('Location: login.php');
exit();
}
require 'db.php.inc';
try {
$stmt = $pdo->prepare("SELECT * FROM users WHERE user_id = :user_id");
$stmt->execute([':user_id' => $_SESSION['user']['user_id']]);
$userDetails = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$userDetails) {
throw new Exception('User details not found.');
}
} catch (Exception $e) {
die('Error fetching user details: ' . $e->getMessage());
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Profile</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<?php include 'header.php'; ?>
<main>
<?php include 'sidebar.php';?>
<div class="profile-container">
<img src="images/<?php echo $userDetails['photo_path']; ?>" alt="User Photo" class="profile-photo">
<div class="profile-info">
<h3><?php echo $userDetails['full_name']; ?></h3>
<p><span>Role:</span> <?php echo $userDetails['role']; ?></p>
<p><span>Email:</span> <?php echo $userDetails['email']; ?></p>
<p><span>Username:</span> <?php echo $userDetails['username']; ?></p>
</div>
</div>
<div class="info-box">
<div><span>Date of Birth:</span> <?php echo $userDetails['dob']; ?></div>
<div><span>Address:</span> <?php echo $userDetails['address']; ?></div>
<div><span>ID Number:</span> <?php echo $userDetails['id_number']; ?></div>
<div><span>Telephone:</span> <?php echo $userDetails['telephone']; ?></div>
<div><span>Qualification:</span> <?php echo $userDetails['qualification']; ?></div>
<div><span>Skills:</span> <?php echo $userDetails['skills']; ?></div>
</div>
</main>
<?php include 'footer.php';?>
</body>
</html>