-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
202 lines (179 loc) · 7.18 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
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<?php
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
?>
<html>
<head>
<title>MyDiary Profile</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
<style>
#container{
transition-duration: 0.5s;
-webkit-transition-duration: 0.5s;
-moz-transition-duration: 0.5s;
}
</style>
</head>
<?php require_once('fade.php'); ?>
<?php require_once('connection.php');?>
<?php
$sql = "SELECT * FROM users WHERE UserID = " . $_SESSION['UserID'];
?>
<body id="container" onload="checkPassword('')">
<?php
require_once('loggedNavbar.php');
if($result = mysqli_query($link, $sql)){
if(mysqli_num_rows($result) > 0){
$row = mysqli_fetch_array($result);
$first_name = $row['FirstName'];
$last_name = $row['LastName'];
$email = $row['Email'];
$password = $row['Password'];
}else{
header("location: login.php");
Exit();
}
}else{
echo "Could not execute sql statement: $sql";
}
?>
<div class="container-fluid">
<div class="row" style="margin-top: 9vh;">
<div class="col-lg-3 col-md-3 col-sm-3 sidebar" style="background-color: #292b2c; color: white; display: flex; align-items: center; justify-content: center;" id="list">
<ul class="list-group" style="margin-top: 10vh; height: 100vh; width: 80%;">
<a href="#" onclick="showPersonal()" class="list-group-item list-group-item-action" style="margin-top: 1%;">Personal Details</a>
<a href="#" onclick="showTechnical()" class="list-group-item list-group-item-action" style="margin-top: 1%;">Technical Details</a>
</ul>
</div>
<div class="col-lg-9 col-md-9 col-sm-9">
<div class="container-fluid" style="margin-top: 3%;" id="personalDetails">
<form action="profileUpdateScript.php" method="post">
<div class="card">
<div class="card-header">
<h1>Your Personal Details</h1>
</div>
<div class="card-block">
<ul class="list-group list-group-flush">
<h4>Your Name</h4>
<div class="form-group" id="firstNameDiv">
<li class="list-group-item">
<p style="width: 100%;">
First Name:
<input
name="first_name"
id="FirstName"
type="text"
onfocus="checkFirstName(this.value)"
onkeyup="checkFirstName(this.value)"
class="form-control"
style="float: right; margin-top: 1%;"
value="<?php
if (isset($first_name)){
echo $first_name;
}
?>"
></input>
</p>
<div class="form-control-feedback" id="firstNameError"></div>
</li>
</div>
<div class="form-group" id="lastNameDiv">
<li class="list-group-item">
<p style="width: 100%;">Last Name: <input
name="last_name"
id="LastName"
type="text"
onfocus="checkLastName(this.value)"
onkeyup="checkLastName(this.value)"
class="form-control"
style="float: right; margin-top: 1%;"
value="<?php
if(isset($last_name)){
echo $last_name;
}
?>"
></input></p>
<div class="form-control-feedback" id="lastNameError"></div>
</li>
</div>
</ul>
<ul class="list-group list-group-flush" style="margin-top: 2.5%;">
<h4>Your Password</h4>
<li class="list-group-item">
<p style="width: 100%;">Previous Password: <input class="form-control" type="password" style="float: right; margin-top: 1%;" value="<?php
if(isset($password)){
echo $password;
}
?>"></input></p>
</li>
<div class="form-group" id="passwordDiv">
<li class="list-group-item">
<p style="width: 100%;">New Password: <input
name="password"
id="Password"
class="form-control"
onfocus="checkPassword(this.value)"
onkeyup="checkPassword(this.value)"
type="password"
style="float: right; margin-top: 1%;"
></input></p>
<div class="form-control-feedback" id="passwordError"></div>
</li>
</div>
<div class="form-group" id="cPasswordDiv">
<li class="list-group-item">
<p style="width: 100%;">Confirm Password: <input
class="form-control"
id="cPassword"
onfocus="confirmPassword(this.value)"
onkeyup="confirmPassword(this.value)"
type="password"
style="float: right; margin-top: 1%;"
></input></p>
<div class="form-control-feedback" id="cPasswordError"></div>
</li>
</div>
</ul>
<p style="width: 100%;"><button class="btn btn-lg btn-primary" id="updateButton" style="float: right; margin-top: 1%;">Update</button></p>
</div>
</div>
</form>
</div>
<div class="container-fluid" style="margin-top: 3.5%;" id="technicalDetails">
<form action="emailUpdateScript.php" method="post">
<div class="card">
<div class="card-header">
<h1>Your Technical Details</h1>
</div>
<div class="card-block">
<ul class="list-group list-group-flush">
<h4>Your Email</h4>
<li class="list-group-item">
<p style="width: 100%;">Current Email: <input type="text" class="form-control" style="float: right; margin-top: 1%;" value="<?php
if(isset($email)){
echo $email;
}
?>"></input></p>
</li>
<li class="list-group-item">
<p style="width: 100%;">New Email: <input type="text" name="email" class="form-control" style="float: right; margin-top: 1%;"></input></p>
</li>
<li class="list-group-item">
<p style="width: 100%;">Confirm Email: <input type="text" class="form-control" style="float: right; margin-top: 1%;"></input></p>
</li>
<p style="width: 100%;"><button class="btn btn-lg btn-primary" style="float: right; margin-top: 1%;">Update</button></p>
</ul>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script src="js/profileScript.js"></script>
</body>
</html>