-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.html
More file actions
153 lines (147 loc) · 3.99 KB
/
profile.html
File metadata and controls
153 lines (147 loc) · 3.99 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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
session_start();
if(!isset($_SESSION['loggedin']) || $_SESSION['loggedin']!=true){
header("location: login.php");
exit;
<?php
?>
?>
}
?>
<!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>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
background: url("1.jpg");
background-size: cover;
}
.navbar {
background-color: #333;
overflow: hidden;
}
.navbar-brand {
float: left;
font-size: 24px;
color: #fff;
padding: 15px 20px;
text-decoration: none;
}
.navbar-brand:hover {
background-color: #f0c56a;
}
.navbar-options {
float: right;
}
.navbar-options a {
display: inline-block;
color: #fff;
text-align: center;
padding: 15px 20px;
text-decoration: none;
}
.navbar-options a:hover {
background-color: #f0c56a;
}
.container {
max-width: 400px;
margin: 50px auto;
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
background-color: #e1e6eb;
text-align: center; /* Center align content */
}
.profile-picture {
width: 150px;
height: 150px;
border-radius: 50%;
margin-bottom: 20px; /* Adjust margin */
}
.username {
margin-bottom: 10px;
font-size: 24px;
}
.user-info {
margin-bottom: 20px; /* Adjust margin */
}
label {
font-weight: bold;
}
#profile-picture-input {
display: none;
}
#upload-button {
display: block;
width: 150px;
margin: 0 auto;
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
margin-bottom: 20px; /* Adjust margin */
}
</style>
</head>
<body>
<div class="navbar">
<a href="#" class="navbar-brand">Brand Name</a>
<div class="navbar-options">
<a href="#">Home Page</a>
<a href="#">Editor</a>
<a href="#">Logout</a>
</div>
</div>
<div class="container">
<img class="profile-picture" src="default_profile_picture.jpg" alt="Profile Picture" id="profile-picture">
<button id="upload-button">Upload Picture</button>
<input type="file" accept="image/*" id="profile-picture-input" onchange="previewPicture(event)">
<div class="username"><?php echo $_SESSION['username']?></div>
<div class="user-info">
<div>
<label for="fname">First Name:</label>
<span id="fname"><?php echo $_SESSION['fname']?></span>
</div>
<div>
<label for="lname">Last Name:</label>
<span id="lname"><?php echo $_SESSION['lname']?></span>
</div>
<div>
<label for="email">Email:</label>
<span id="email">johndoe@example.com</span>
</div>
</div>
</div>
<script>
// Check if profile picture data exists in local storage
var profilePictureData = localStorage.getItem('profilePictureData');
if (profilePictureData) {
document.getElementById('profile-picture').src = profilePictureData;
}
function previewPicture(event) {
var input = event.target;
var reader = new FileReader();
reader.onload = function () {
var profilePicture = document.getElementById('profile-picture');
profilePicture.src = reader.result;
// Store profile picture data in local storage
localStorage.setItem('profilePictureData', reader.result);
};
reader.readAsDataURL(input.files[0]);
}
document.getElementById('upload-button').onclick = function () {
document.getElementById('profile-picture-input').click();
};
</script>
</body>
</html>