-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.php
More file actions
108 lines (70 loc) · 2.62 KB
/
Copy pathsettings.php
File metadata and controls
108 lines (70 loc) · 2.62 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
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
<?php
include "inc/header.php";
include "classes/User.php";
$db = new Database();
$format = new Format();
?>
<?php
if (!isset($_SESSION['login'])) {
header("location: login.php?msg=Login First");
}
if(isset($_POST['submit'])){
if((isset($_POST['oldpsk'])) || (isset($_POST['newpsk']))){
$userEmail = $_SESSION['login'];
$getPsk = $db->select("SELECT * FROM register WHERE user_email='$userEmail'");
$pskRow = $getPsk->fetch_assoc();
$oldpsk = $format->Spsk($_POST['oldpsk']);
$psk = $format->Spsk($_POST['newpsk']);
if($oldpsk == $pskRow['user_pass']){
$pskExe = $db->update("UPDATE register SET user_pass='$psk' WHERE user_email='$userEmail'");
if($pskExe){
echo "<a class='alert alert-success'>Password Change successfully</a>";
}
}else{
echo "<a class='alert alert-danger'>Your old password error :(</a>";
}
}else{
echo "<a class='alert alert-danger'>Enter all field</a>";
}
}
if(isset($_POST['delete'])){
$dl = deleteAccountByEmail($_SESSION['login']);
if($dl){
Format::jumpTo("logout.php", "Acoount deleted...");
}else{
Format::jumpTo("settings.php", "Something went wrong");
}
}
?>
<form method="post" action="">
<div class="container">
<div class="row">
<div class="m-justify col-xs-6 col-sm-3">
<div class="m-card">
<div class="m-card-body">
<h3>Change Password</h3>
<div class="m-input-group">
<input name="oldpsk" type="text" autocomplete="off" class="m-form-control text-dark"/>
<label>Old Password</label>
</div>
<div class="m-input-group">
<input name="newpsk" type="text" autocomplete="off" class="m-form-control text-dark" />
<label>New Password</label>
</div>
<input class="m-btn waves-effect" type="submit" name="submit" Value="Update" />
</div>
</div>
</div>
<div class="m-justify col-xs-6 col-sm-3">
<div class="m-card">
<div class="m-card-body">
<h4>Account</h4>
<hr>
<input class="m-btn waves-effect" type="submit" name="delete" value="Delete Account">
</div>
</div>
</div>
</div>
</div>
</form>
<?php include "inc/footer.php"; ?>