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