-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreset_otp.php
55 lines (53 loc) · 1.68 KB
/
reset_otp.php
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
<?php
session_start();
require('mysql_conn.php');
require('send.php');
$otp_val=rand(10000,99999);
$_SESSION['otp_reset']=$otp_val;
/*
* send otp to the registered email here
* */
$username=trim($_POST['user_name']);
$username=filter_var($username,FILTER_SANITIZE_STRING);
$result=$conn->query("select * from users where username='$username';");
$row=$result->fetch_assoc();
if($result->num_rows==0){
header('location:reset_login.php?r=0');
exit;
}else if($result->num_rows==1){
if($row['delete_flag']==1){
header('location:reset_login.php?r=0');
exit;
}else{
$email=$row['email'];
sendOTP($otp_val,$email);
}
}else{
header('location:reset_login.php?r=0');
exit;
}
?>
<html>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<head>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>
<div class="header_wrap">
<div class="header_div">
<div class="menu_item first_menu_item"><a href="reset_login.php"><</a>
</div><div class="menu_item act_menu"><a href="reset_login.php">reset</a>
</div>
</div></div>
<div class="content_div">
<div class="welcome"><h1>reset your login</h1><p>otp is sent to your email.</div>
<form class="content" action="reset.php" method="post">
<input class="input_text" type="text" name="otp" placeholder="enter otp"/><br>
<input class="input_text" type="hidden" name="user_name" value="<?php echo $username;?>"/>
<input class="input_text" type="password" name="pass_word" placeholder="enter new password"/><br>
<input class="input_text" type="password" name="re_pass_word" placeholder="re-enter new password"/><br>
<input class="input_button" type="submit" value="submit"/>
</form>
</div>
</body>
</html>