-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgiveOTP.php
More file actions
48 lines (43 loc) · 920 Bytes
/
giveOTP.php
File metadata and controls
48 lines (43 loc) · 920 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
38
39
40
41
42
43
44
45
46
47
48
<?php
$html="";
include('connect.php');
if(!empty($_GET["UID"]))
{
$uid=$_GET["UID"];
echo $uid;
$otp=rand(1111,9999);
echo "The OTP is ".$otp;
$sql = "UPDATE users SET OTP=".$otp." WHERE UId='".$uid."'";
echo"<br>";
echo $sql;
if ($conn->query($sql) === TRUE)
{
echo "Record updated successfully";
}
else
{
echo "Error updating record: " . $conn->error;
}
//////////////fetching phone number /////////////
$phone=0;
$sql2 = "SELECT * FROM users WHERE UId='".$uid."'";
$result = $conn->query($sql2);
if ($result->num_rows > 0)
{
// output data of each row
while($row = $result->fetch_assoc())
{
echo "Phone is " . $row["Phone"]. "<br>";
$phone= $row["Phone"];
}
}
else
{
echo "0 results";
}
$conn->close();
$url="http://jayantbenjamin.000webhostapp.com/RAIThack/sendmsg.php?ph=".$phone."&otp=".$otp;
$html = file_get_contents($url);
echo $html;
}
?>