-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.php
69 lines (58 loc) · 1.72 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
<?php
include_once "config.php";
global $USER,$MSG;
$PAGE="user";
include_once "includes/header.php";
$submit = optional_param('submit','',PARAM_TEXT);
if($USER->username == "demo"){
echo "<p>Sorry - you can't edit the demo user account</p>";
include_once "includes/footer.php";
die;
}
if($submit != ""){
$password = optional_param('password','',PARAM_TEXT);
$confirmpassword = optional_param('confirmpassword','',PARAM_TEXT);
if($password != $confirmpassword){
array_push($MSG,"Passwords don't match");
} else {
if($API->userChangePassword($USER->userid,$password)){
array_push($MSG,"Your password has been changed");
writeToLog('info','passwordchanged','');
} else {
array_push($MSG,"There was an error changing your password");
}
}
}
?>
<h2>User edit page</h2>
<?php
if(!empty($MSG)){
echo "<ul>";
foreach ($MSG as $err){
echo "<li>".$err."</li>";
}
echo "</ul>";
}
?>
<form method="post" action="">
<div class="formblock">
<div class="formlabel">Username:</div>
<div class="formfield"><input type="text" name="username" value="<?php echo $USER->username;?>" disabled="true"></input></div>
<div class="forminfo">You cannot change your username</div>
</div>
<div class="formblock">
<div class="formlabel">New password:</div>
<div class="formfield"><input type="password" name="password"></input></div>
</div>
<div class="formblock">
<div class="formlabel">Confirm new password:</div>
<div class="formfield"><input type="password" name="confirmpassword"></input></div>
</div>
<div class="formblock">
<div class="formlabel"> </div>
<div class="formfield"><input type="submit" name="submit" value="Change password"></input></div>
</div>
</form>
<?php
include_once "includes/footer.php";
?>