-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathresetPassword.php
More file actions
40 lines (30 loc) · 901 Bytes
/
resetPassword.php
File metadata and controls
40 lines (30 loc) · 901 Bytes
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
<?php
require "connection.php";
$email = $_POST["e"];
$np = $_POST["n"];
$rnp = $_POST["r"];
$vcode = $_POST["v"];
if (empty($email)){
echo("Missing Email address");
}else if (empty($np)){
echo("Please insert a New Password");
}else if(strlen($np)<5 || strlen($np)>20){
echo("Invalid Password");
}else if (empty($rnp)){
echo("Please Re-type your New Password");
}else if ($np != $rnp){
echo("Password does not matched");
}else if (empty($vcode)){
echo("Please enter your Verification Code");
}else{
$rs = Database::search("SELECT * FROM `users` WHERE `email`='".$email."' AND
`verification_code`='".$vcode."'");
$n =$rs->num_rows;
if($n == 1){
Database::iud("UPDATE `users` SET `password`='".$np."' WHERE `email`='".$email."'");
echo("success");
}else{
echo("Invalid Email or Verification Code");
}
}
?>