-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathotpprocess.php
117 lines (85 loc) · 2.8 KB
/
otpprocess.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
session_start();
// $url='localhost';
// $username = "root";
// $password = "";
// $dbname = "hackathon";
// $conn = mysqli_connect($url, $username, $password, $dbname);
$con=mysqli_connect("localhost","root","","online_exam"); //avd1979
if (!$con)
{
echo "Failed to connect to MySQL: " . mysqli_error();
}
/*$_SESSION['name']=$_POST['email'];
$_SESSION['email']=$_POST['email'];
$_SESSION['num']=$_POST['num'];
$_SESSION['password']=$_POST['password'];
$_SESSION['sex']=$_POST['sex'];
$_SESSION['address']=$_POST['address'];
$_SESSION['dob']=$_POST['dob'];
$_SESSION['aadhar']=$_POST['aadhar'];*/
//$_SESSION['otp']=$rndno;
//header("Location: index.php");
$name=$_POST['name'];
$email=$_POST['email'];
$num=$_POST['num'];
$password=md5($_POST['password']);
$sex=$_POST['sex'];
$address=$_POST['address'];
$aadhar=$_POST['aadhar'];
$dob=$_POST['dob'];
$dist=$_POST['dist'];
$state=$_POST['state'];
$pincode=$_POST['pincode'];
$_SESSION['username'] = $email;
$_SESSION['Name'] = $name;
$rno = $_SESSION['otp'];
$urno=$_POST['otpvalue'];
if(!strcmp($rno,$urno))
{
$res1 = mysqli_query($con, "SELECT Email FROM login_jobseeker WHERE Email='".$email."'");
if($res1)
{
echo "Email already exist";
}
$sql = "INSERT INTO candidate (Name,Address,District,State,Mobile,Pincode,DOB,Gender,EmailID,Password,AadharCard)
VALUES ('$name','$address','$dist','$state','$num','$pincode','$dob','$sex','$email','$password','$aadhar')";
if (mysqli_query($con, $sql)) {
$sql1 = "insert into login_jobseeker(Email,Password) values ('$email','$password')";
if(mysqli_query($con, $sql1)){
// $_SESSION['username'] = $email;
header( "Location: dashboard/student.php");
exit();
}
/*$username = "[email protected]";
$hash = "b643e19e6a83bbed6d33e557ad79a58d0088af7ac49ddde5bb5096bd59002941";
$test = "0";
$sender = "TXTLCL";
$message = urlencode("Thank u for register with us. we will get back to u shortly.");
$data = "username=".$username."&hash=".$hash."&message=".$message."&sender=".$sender."&num=".$num."&test=".$test;
$ch = curl_init('http://api.textlocal.in/send/');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
echo($result);
if(curl_errno($ch))
{
echo 'error:' . curl_error($ch);
}
curl_close($ch);
header( "Location: dashboard/admin.php");*/
}
else {
echo "Error: " . $sql . "<br>" . mysqli_error($con);
}
mysqli_close($con);
return true;
}
else
{
echo "Entered OTP do not match";
return false;
}
?>