-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
107 lines (94 loc) · 2.54 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
session_start();
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit;
}
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "user";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM Users WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $_SESSION['user_id']);
$stmt->execute();
$result = $stmt->get_result();
$user = $result->fetch_assoc();
$conn->close();
?>
<!DOCTYPE html>
<html>
<head>
<title>Profile</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #EEF5FF;
padding: 20px;
}
.form-heading {
text-align: center;
margin-bottom: 20px;
}
.form-fields {
background-color: #fff;
padding: 20px;
border-radius: 5px;
max-width: 500px;
margin: auto;
}
.detail-box {
background-color: #f1f1f1;
padding: 10px;
border-radius: 5px;
margin-bottom: 20px;
}
.logout-button {
background-color: red;
color: white;
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
text-align: center;
display: block;
margin: auto;
margin-top: 20px;
width: 100px;
text-decoration: none;
transition: background-color 0.3s ease;
}
.logout-button:hover {
background-color: darkred;
}
.logout-button:active {
background-color: #700;
}
</style>
</head>
<body>
<div class="form-fields">
<label>Photo:</label>
<div class="detail-box">
<img src='images/<?php echo $user['photo']; ?>' width='100'>
</div>
<label>Full Name:</label>
<div class="detail-box">
<p><?php echo $user['firstName']; ?> <?php echo $user['lastName']; ?></p>
</div>
<label>Email:</label>
<div class="detail-box">
<p><?php echo $user['email']; ?></p>
</div>
<label>Bio:</label>
<div class="detail-box">
<textarea readonly style="width: 100%; border: none; background: none;"><?php echo $user['bio']; ?></textarea>
</div>
<a class="logout-button" href="login.php">Logout</a>
</div>
</body>
</html>