forked from zeus911/SSLChecker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
account.php
99 lines (83 loc) · 2.88 KB
/
account.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
<?php
session_start();
include_once("config.php");
include_once("lib/functions.php");
if (!isset($_SESSION['admin']) && $_SESSION['admin'] != 1) {
header('Location: index.php');
return;
}
if(!isset($_SESSION['username'])) {
header("Location: login.php");
return;
}
if(!isset($_GET['pid'])) {
header("Location: index.php");
}
$pid = $_GET['pid'];
$error = "";
if(isset($_POST['update'])) {
$username = $_SESSION['username'];
$password = $_POST['password'];
$newpassword = $_POST['newpassword'];
$account = new account();
$account->db = $db;
$result = $account->changePassword($password, $newpassword, $pid, $username);
echo $result;
if ($result == "success") {
$error = "
<div class='alert alert-success alert-dismissible fade show' role='alert'>
<button type='button' class='close' data-dismiss='alert'><span>×</span></button>
<strong>Congratulations!</strong><br> You successfully updated your password!
</div>
";
} else {
$error = "
<div class='alert alert-Danger alert-dismissible fade show' role='alert'>
<button type='button' class='close' data-dismiss='alert'><span>×</span></button>
<strong>Error!</strong><br> Something went wrong.
</div>
";
}
}
?>
<!DOCTYPE html>
<html>
<?php
include("header.php");
?>
<main class="main-container">
<div class="main-content">
<div class="row">
<div class="col-lg-6">
<div class="card">
<h4 class="card-title"><strong>Change password</strong></h4>
<?php echo "$error"; ?>
<div class="card-body">
<div class="row">
<div class="col-lg-12">
<form class="form-type-material" role="form" <?php echo "action='account.php?pid=$pid'"; ?> method="POST" enctype="multipart/form-data">
<div class="form-group">
<input type="password" class="form-control" name="password" id="password">
<label for="password">Password</label>
</div>
<div class="form-group">
<input type="password" class="form-control" name="newpassword" id="newpassword">
<label for="password">Confirm Password</label>
</div>
<div class="form-group">
<button name="update" value="update" class="btn btn-bold btn-block btn-primary" type="submit">Save</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
</div>
</div>
</div>
<?php
include("footer.php");
?>
</html>