-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset.php
More file actions
64 lines (43 loc) · 1.63 KB
/
Copy pathreset.php
File metadata and controls
64 lines (43 loc) · 1.63 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
<?php
include "inc/header.php";
$db = new Database();
$format = new Format();
if (!isset($_GET["code"])) {
echo "Can't find page";
}
$ucode = $format->Stext($_GET["code"]);
$getEmailQuery = "SELECT * FROM ucode WHERE code = '$ucode' ";
$getEmailData = $db->select($getEmailQuery);
if ($getEmailData){
$getEmailData = $getEmailData->fetch_assoc();
}else{
echo "No data found";
}
if (isset($_POST["submit"])) {
$pass =$format->Spsk($_POST["password"]);
$email = $getEmailData["email"];
$query = "UPDATE register SET user_pass='$pass' WHERE user_email='$email'";
$update = $db->update($query);
if ($update){
$query ="DELETE FROM ucode WHERE code ='$ucode'";
$psch = $db->delete($query);
if($psch){
Format::jumpTo("login.php","Password changed successfully");
}
else{
Format::jumpTo("login.php","Password Not changed successfully");
}
}
else{
Format::jumpTo("reset.php","something went wrong");
}
}
?>
<form class="form-signin" action="" method="POST">
<h1 class="h3 mb-3 font-weight-normal text-white">Enter new password</h1>
<label for="inputEmail" class="sr-only">New password</label>
<input type="text" name="password" id="inputEmail" class="form-control" placeholder="New password" required autofocus>
<br>
<button class="btn btn-lg btn-primary btn-block" name="submit" type="submit">Reset Password</button>
</form>
<?php include "inc/footer.php"; ?>