-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
43 lines (38 loc) · 1.42 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
<?php
session_start();
include('php/config.php');
if (isset($_SESSION['ID'])) {
$userId = $_SESSION['ID'];
$query = "SELECT id, name, username, email FROM users WHERE id = ?";
$stmt = $con->prepare($query);
$stmt->bind_param("i", $userId);
$stmt->execute();
$stmt->bind_result($id, $name, $username, $email);
$stmt->fetch();
$stmt->close();
} else {
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</title>
<link rel="stylesheet" href="css/homepage.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" />
</head>
<body>
<?php include 'header.php'; ?>
<section class="user-details" style="margin-top: 80px;">
<div class="user">
<p><i class="fas fa-user"></i><span><?php echo htmlspecialchars($name); ?></span></p>
<p><i class="fas fa-id-badge"></i><span>ID: <?php echo htmlspecialchars($id); ?></span></p>
<p><i class="fas fa-user-circle"></i><span>Username: <?php echo htmlspecialchars($username); ?></span></p>
<p><i class="fas fa-envelope"></i><span>Email: <?php echo htmlspecialchars($email); ?></span></p>
</div>
</section>
</body>
</html>