-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.php
332 lines (293 loc) · 14.4 KB
/
user.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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<?php
session_start();
include "connection.php";
if(isset($_SESSION['user_id']))
{
$user_id=$_SESSION['user_id'];
$info=$database->getReference('cms/user')->getChild($user_id)->getValue();
if(isset($info['about']))
$about=$info['about'];
else
$about=" -- ";
if(isset($info['hobbies']))
$hobbies=$info['hobbies'];
else
$hobbies=" -- ";
$email=$info['email'];
$fname=$info['name'];
$lname=$info['name'];
$image=$database->getReference('cms/user')->getChild($user_id)->getChild('image')->getValue();
$pass=$database->getReference('cms/user')->getChild($user_id)->getChild('password')->getValue();
}
if(isset($_POST['submit'])){
$about = $_POST["about"];
$fname = $_POST["fname"];
//$lname = $_POST["lname"];
$hobbies = $_POST["hobbies"];
$email = $_POST["email"];
$pass=$_POST["password"];
$r_pass=$_POST["rpassword"];
$post_image=$_FILES['image']['name'];
$post_image_temp=$_FILES['image']['tmp_name'];
if(strcmp($pass,$r_pass)==0)
{
$database->getReference('cms/user')->getChild($user_id)->getChild('password')->set($pass);
}
else
{
echo "<script>alert('Password did not match');<script>";
}
$database->getReference('cms/user')->getChild($user_id)->getChild('about')->set($about);
$database->getReference('cms/user')->getChild($user_id)->getChild('hobbies')->set($hobbies);
$database->getReference('cms/user')->getChild($user_id)->getChild('password')->set($pass);
$database->getReference('cms/user')->getChild($user_id)->getChild('email')->set($email);
$database->getReference('cms/user')->getChild($user_id)->getChild('name')->set($fname);
}
?>
<!DOCTYPE html>
<html >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Codeply preview</title>
<base target="_self">
<meta name="description" content="Example user profile form and information editing form for Bootstrap 4. This snippet has tabs to separate other profile info such as messages or notifications. Sidebar with profile image." />
<meta name="google" value="notranslate">
<link rel="shortcut icon" href="/images/cp_ico.png">
<!--stylesheets / link tags loaded here-->
<!--<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" />-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
</head>
<body >
<div class="container">
<div class="row my-2">
<div class="userpic">
<div class="img-responsive text-center">
<img src="images/<?php echo $image;?>" class="mx-auto img-fluid img-circle d-block" alt="avatar">
<h6 class="mt-2">Upload a different photo</h6>
<div class='form-group'>
<label class="custom-file">
<span class="custom-file-control">Choose file</span>
<input type="file" id="file" class="form-control">
</label>
</div>
</div>
</div>
<div class="col-lg-8 order-lg-2">
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="" data-target="#profile" data-toggle="tab" class="nav-link active">Profile</a>
</li>
<li class="nav-item">
<a href="" data-target="#messages" data-toggle="tab" class="nav-link">Messages</a>
</li>
<li class="nav-item">
<a href="" data-target="#edit" data-toggle="tab" class="nav-link">Edit</a>
</li>
</ul>
<div class="tab-content py-4">
<div class="tab-pane active" id="profile">
<h5 class="mb-3"><?php echo $fname;?></h5>
<!--<h5 class="mb-3">User Profile</h5>-->
<div class="row">
<div class="col-md-6">
<h6>About</h6>
<p><?php
echo $about;
?></p>
<h6>Hobbies</h6>
<p>
<?php echo $hobbies;
?>
</p>
</div>
<div class="col-md-6">
<h6>Recent badges</h6>
<a href="#" class="badge badge-dark badge-pill">html5</a>
<a href="#" class="badge badge-dark badge-pill">react</a>
<a href="#" class="badge badge-dark badge-pill">codeply</a>
<a href="#" class="badge badge-dark badge-pill">angularjs</a>
<a href="#" class="badge badge-dark badge-pill">css3</a>
<a href="#" class="badge badge-dark badge-pill">jquery</a>
<a href="#" class="badge badge-dark badge-pill">bootstrap</a>
<a href="#" class="badge badge-dark badge-pill">responsive-design</a>
<hr>
<span class="badge badge-primary"><i class="fa fa-user"></i> 900 Followers</span>
<span class="badge badge-success"><i class="fa fa-cog"></i> 43 Forks</span>
<span class="badge badge-danger"><i class="fa fa-eye"></i> 245 Views</span>
</div>
<div class="col-md-12">
<h5 class="mt-2"><span class="fa fa-clock-o ion-clock float-right"></span> Recent Activity</h5>
<table class="table table-sm table-hover table-striped">
<tbody>
<tr>
<td>
<strong>Abby</strong> joined ACME Project Team in <strong>`Collaboration`</strong>
</td>
</tr>
<tr>
<td>
<strong>Gary</strong> deleted My Board1 in <strong>`Discussions`</strong>
</td>
</tr>
<tr>
<td>
<strong>Kensington</strong> deleted MyBoard3 in <strong>`Discussions`</strong>
</td>
</tr>
<tr>
<td>
<strong>John</strong> deleted My Board1 in <strong>`Discussions`</strong>
</td>
</tr>
<tr>
<td>
<strong>Skell</strong> deleted his post Look at Why this is.. in <strong>`Discussions`</strong>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!--/row-->
</div>
<div class="tab-pane" id="messages">
<div class="alert alert-info alert-dismissable">
<a class="panel-close close" data-dismiss="alert">×</a> This is an <strong>.alert</strong>. Use this to show important messages to the user.
</div>
<table class="table table-hover table-striped">
<tbody>
<tr>
<td>
<span class="float-right font-weight-bold">3 hrs ago</span> Here is your a link to the latest summary report from the..
</td>
</tr>
<tr>
<td>
<span class="float-right font-weight-bold">Yesterday</span> There has been a request on your account since that was..
</td>
</tr>
<tr>
<td>
<span class="float-right font-weight-bold">9/10</span> Porttitor vitae ultrices quis, dapibus id dolor. Morbi venenatis lacinia rhoncus.
</td>
</tr>
<tr>
<td>
<span class="float-right font-weight-bold">9/4</span> Vestibulum tincidunt ullamcorper eros eget luctus.
</td>
</tr>
<tr>
<td>
<span class="float-right font-weight-bold">9/4</span> Maxamillion ais the fix for tibulum tincidunt ullamcorper eros.
</td>
</tr>
</tbody>
</table>
</div>
<div class="tab-pane" id="edit">
<form role="form" method="POST">
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Name</label>
<div class="col-lg-9">
<input class="form-control" type="text" value="<?php echo $fname; ?>" name="fname" >
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Email</label>
<div class="col-lg-9">
<input class="form-control" type="email" value="<?php echo $email; ?>" name='email'>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">about</label>
<div class="col-lg-9">
<input class="form-control" type="text" value="<?php echo $about; ?>" name='about'>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">hobbies</label>
<div class="col-lg-9">
<input class="form-control" type="text" value="<?php echo $hobbies; ?>"name='hobbies'>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Password</label>
<div class="col-lg-9">
<input class="form-control" type="password" value="<?php echo $pass;?>" name='password'>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Confirm password</label>
<div class="col-lg-9">
<input class="form-control" type="password" value="<?php echo $pass; ?>" name='rpassword'>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label"></label>
<div class="col-lg-9">
<input type="reset" class="btn btn-secondary" value="Cancel">
<input type="submit" class="btn btn-primary" value="Save Changes" name="submit">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
// sandbox disable popups
if (window.self !== window.top && window.name!="view1") {;
window.alert = function(){/*disable alert*/};
window.confirm = function(){/*disable confirm*/};
window.prompt = function(){/*disable prompt*/};
window.open = function(){/*disable open*/};
}
// prevent href=# click jump
document.addEventListener("DOMContentLoaded", function() {
var links = document.getElementsByTagName("A");
for(var i=0; i < links.length; i++) {
if(links[i].href.indexOf('#')!=-1) {
links[i].addEventListener("click", function(e) {
console.debug("prevent href=# click");
if (this.hash) {
if (this.hash=="#") {
e.preventDefault();
return false;
}
else {
/*
var el = document.getElementById(this.hash.replace(/#/, ""));
if (el) {
el.scrollIntoView(true);
}
*/
}
}
return false;
})
}
}
}, false);
</script>
<style type="text/css">
.userpic img {
float: none;
margin: 0 auto;
width: 50%;
height: 50%;
-webkit-border-radius: 50% !important;
-moz-border-radius: 50% !important;
border-radius: 50% !important;
}
</style>
<!--scripts loaded here-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"></script>
<script>
</script>
</body>
</html>