-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.php
More file actions
82 lines (70 loc) · 2.59 KB
/
profile.php
File metadata and controls
82 lines (70 loc) · 2.59 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
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
<?php
session_start();
require 'db.php';
if(!isset($_SESSION['user_id'])){
header("Location: login.php");
exit();
}
$user_id=$_SESSION['user_id'];
$stmt=$conn->prepare("SELECT ID,Name,Email,Address,Phone,Photo,created FROM users WHERE ID=?");
$stmt->bind_param("i",$user_id);
$stmt->execute();
$result=$stmt->get_result();
if($result->num_rows>0){
$user=$result->fetch_assoc();
}else{
$_SESSION['error']='no user data found.';
exit();
}
$stmt->close();
$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Profile Page</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
</head>
<body>
<div class="container mt-5">
<div class="row">
<div class="col-md-4">
<img src="uploads/<?php echo htmlspecialchars($user['Photo']); ?>" class="img-thumbnail"
alt="Profile Photo">
</div>
<div class="col-md-8">
<h2>Profile</h2>
<table class="table table-bordered">
<tbody>
<tr>
<th>Name</th>
<td><?php echo htmlspecialchars($user['Name']); ?></td>
</tr>
<tr>
<th>Email</th>
<td><?php echo htmlspecialchars($user['Email']); ?></td>
</tr>
<tr>
<th>Phone</th>
<td><?php echo htmlspecialchars($user['Phone']); ?></td>
</tr>
<tr>
<th>Address</th>
<td><?php echo htmlspecialchars($user['Address']); ?></td>
</tr>
<tr>
<th>Created At</th>
<td><?php echo htmlspecialchars($user['created']); ?></td>
</tr>
</tbody>
</table>
<a href="logout.php" class="btn btn-danger">Logout</a>
<a href="edit_data_user.php?id=<?php echo $user['ID'];?>" class="btn btn-success">Edit Profile</a>
</div>
</div>
</div>
</body>
</html>