-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathf1_check.php
36 lines (28 loc) · 929 Bytes
/
f1_check.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
<?php
$host="localhost";
$user="root";
$password="";
$db="sgs";
$email=$_POST['email'];
$conn=mysqli_connect($host,$user,$password,$db);
$sql="SELECT * FROM studentlist WHERE email='$email'";
$result=mysqli_query($conn,$sql);
if ($result->num_rows==1) {
$otp = rand(100000,999999);
$sql2="UPDATE studentlist SET otp='$otp' WHERE email='$email'";
$result2=mysqli_query($conn,$sql2);
$to=$email;
$subject='Otp for password reset';
$message='your password reset otp is'.$otp.'.';
$header='From:chiragparmar1502@gmail.com';
$m=mail($to,$subject,$message,$header);
session_start();
session_regenerate_id();
$_SESSION['otp']=$otp;
$_SESSION['email']=$email1;
header('location:f2_check.php');
}
else{
echo "<script>alert('User Not Found.');window.location.href='forget_student.php';</script>";
}
?>