-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.php
More file actions
53 lines (50 loc) · 1.58 KB
/
Copy pathprofile.php
File metadata and controls
53 lines (50 loc) · 1.58 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
<?php
session_start();
require_once 'config.php';
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
$user_id = $_SESSION['user_id'];
$stmt = $pdo->prepare("SELECT * FROM users WHERE user_id = ?");
$stmt->execute([$user_id]);
$user = $stmt->fetch();
if (!$user) {
header("Location: login.php");
exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Profile - Realtime Chat App</title>
<link rel="stylesheet" href="./style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
</head>
<body>
<div class="wrapper">
<section class="users">
<header>
<div class="content">
<img src="<?php echo $user['image']; ?>" alt="">
<div class="details">
<span><?php echo $user['first_name'] . ' ' . $user['last_name']; ?></span>
<p><?php echo $user['status']; ?></p>
</div>
</div>
<a href="logout.php" class="logout">Logout</a>
</header>
<div class="profile-info">
<p><strong>Email:</strong> <?php echo $user['email']; ?></p>
<p><strong>Joined:</strong> <?php echo date('F j, Y', strtotime($user['created_at'])); ?></p>
</div>
<div class="profile-actions">
<a href="user.php" class="button-link" style="color: #efefef;">Chat with Users</a>
<a href="edit-profile.php" class="button-link" style="color: #efefef;">Edit Profile</a>
</div>
</section>
</div>
</body>
</html>