-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalotp.php
33 lines (30 loc) · 982 Bytes
/
valotp.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
<?php
session_start();
$dbservername = 'localhost';//or localhost
$dbname = 'project'; // your db_name
$dbusername = 'root'; // root by default for localhost
$dbpassword = ''; // by defualt empty for localhost
if(isset($_SESSION["otp"]))
{
$user=$_SESSION["otp"];
$otpl=$_POST["otp"];
$conn = new mysqli($dbservername, $dbusername, $dbpassword, $dbname);
$cser=mysqli_connect("localhost","root","","project") or die("connection failed:".mysqli_error());
$res = mysqli_query($cser,"select * from otpstore where username='$user'");
$result=mysqli_fetch_array($res);
$otp=$result["otp"];
if($otp==$otpl)
{
$sql="delete from otpstore where username='$user'";
$conn->query($sql);
$_SESSION["newpass"]="s";
header("location:newpass.php");
}
else
{
//if otp is invalid
$_SESSION["v"]="f"; //put f instead of
header("location:ottp.php");
}
}
?>