-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresetPasswordProcess.php
More file actions
48 lines (30 loc) · 1.09 KB
/
resetPasswordProcess.php
File metadata and controls
48 lines (30 loc) · 1.09 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
<?php
include "connection.php";
$email = $_POST["e"];
$newPassword = $_POST["np"];
$retypedPassword = $_POST["rp"];
$vcode = $_POST["v"];
if(!isset($newPassword)){
echo("Please Enter a New Password");
}else if(empty($newPassword)){
echo("Please enter your new password");
}else if(strlen($newPassword)<5 || (strlen($newPassword)>20)){
echo("Password Must Contain Between 5 to 20 characters");
}else if(!isset($retypedPassword)){
echo("Please retype your new password");
}else if(strlen($newPassword)<5 || (strlen($newPassword)>20)){
echo("Password Must Contain Between 5 to 20 characters");
}else if($newPassword != $retypedPassword){
echo("Password do not match");
}
else{
$user_rs = Database::search("SELECT * FROM `users` WHERE `email` = '".$email."' AND `vcode` = '".$vcode."'");
$user_num = $user_rs->num_rows;
if($user_num == 1){
Database::iud("UPDATE `users` SET `password` = '".$retypedPassword."' WHERE `vcode` = '".$vcode."' AND `email` = '".$email."'");
echo("success");
}else{
echo("Invalid Verification Code");
}
}
?>