-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsettings.php
More file actions
62 lines (55 loc) · 1.39 KB
/
settings.php
File metadata and controls
62 lines (55 loc) · 1.39 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
<?php
include_once(__DIR__."/lib/autoload.php");
if (!$auth->isLoggedIn()) {
header('Location: /');
die();
}
$errors = [];
$action = '';
$data = [];
$view = false;
$success = false;
if(isset($_POST['update'])) {
$result = $auth->updatePassword($_POST['opassword'], $_POST['npassword'], $_POST['rpassword']);
if (is_array($result)) {
$errors = $result;
} else {
$success = true;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<?php
$title = "Einstellungen";
require_once(__DIR__."/inc/head.php");
?>
<body>
<?php require_once(__DIR__."/inc/nav.php"); ?>
<section class="main">
<a href="/">Zurück</a>
<h2>Einstellungen</h2>
<?php
foreach ($errors as $key=>$value):
?>
<span style="color: red;">
<?= $value ?>
</span><br>
<?php
endforeach;
if($success == true) {
echo '<span style="color: green;">Passwort aktualisiert!</span><br>';
}
?>
<form action="/settings.php" method="post">
<label for="opassword">Altes Passwort</label>
<input type="password" name="opassword" id="opassword"><br>
<label for="npassword">Passwort</label>
<input type="password" name="npassword" id="npassword"><br>
<label for="rpassword">Passwort Wiederholen</label>
<input type="password" name="rpassword" id="rpassword"><br>
<input type="submit" name="update" value="Update">
</form>
</section>
</body>
</html>