This repository was archived by the owner on Oct 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmysettings.php
More file actions
46 lines (39 loc) · 1.31 KB
/
mysettings.php
File metadata and controls
46 lines (39 loc) · 1.31 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
<?php
include_once 'common/base.php';
$title = 'My settings';
include_once 'common/header.php';
if (!isset($_SESSION['LoggedIn'])) {
terminalError('Need to be logged in first!');
}
?>
<div class="page-header">
<h1>User settings</h1>
</div>
<!-- submitted a new password? do the magic! -->
<?php
if(!empty($_POST['newpassword'])) {
if ($_POST['newpassword']==$_POST['newpassword2']) {
include_once "common/classes/Users.php";
$users = new Users($db);
echo $users->changePassword($_SESSION['Username'], $_POST['currentpassword'], $_POST['newpassword']);
} else {
terminalError('Passwords do not match!');
}
} else {
?>
<!-- else show the form -->
<h2>Change password</h2>
<form method="post" action="mysettings.php">
<label for="currentpassword">Current password</label>
<input type="password" name="currentpassword" id="currentpassword" />
<label for="password">New password</label>
<input type="password" name="newpassword" id="newpassword" />
<label for="password2">Re-type password</label>
<input type="password" name="newpassword2" id="newpassword2" />
<br/>
<button class="btn" type="submit">Change password</button>
</form>
<?php
}
include_once 'common/footer.php';
?>