Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.119.132.80
<?php
include ("database.php");
include("sendsmsapi.php");
error_reporting(E_ALL);
ini_set('display_errors', 'on');
$mobile = trim($_POST['mobile']);
$query = "SELECT fname
from collstud where fmobileno = '{$mobile}' and factive = 'T'";
$result = mysqli_query($conn,$query);
$count = mysqli_num_rows($result);
if($count == 0)
{
$query = "SELECT fname
from collstud where fmobileno = '{$mobile}'";
$result = mysqli_query($conn,$query);
$count = mysqli_num_rows($result);
if($count == 0)
{
$row["status"] = 'invalid';
$row["msg"] = 'Mobile No. not Registered';
echo json_encode($row);
die();
}
$row['status'] = 'success';
date_default_timezone_set('Asia/Kolkata');
$time = date("h:i A");
$motpaswrd = rand(1000, 9000); //strtoupper(substr(sha1(rand()), 0, 4));
$smsotp = "Dear Sir, Your mobile OTP for Registration is {$motpaswrd} sent at {$time}";
$username = 'logisyhttp';
$password = 'Logis986';
$from = 'UNISOL';
$to = $mobile;
$text = $smsotp;
$category = '';
$smsresp = sendsmaapi($username,$password,$from,$to,$text,$category);
//var_dump($smsresp);
$row["sms"] = $smsresp;
//var_dump($row);
$query = "SELECT fname
from collstud where fmobileno = '{$mobile}'";
$result = mysqli_query($conn,$query);
$row1 = mysqli_fetch_assoc($result);
$row['name'] = $row1['fname'];
$query = "update collstud set fmobileotp = '{$motpaswrd}', fmobotptime = now(),
fotpcounter = fotpcounter+1
where fmobileno = '{$mobile}'";
$result = mysqli_query($conn,$query);
echo json_encode($row);
}
else
{
$row["status"] = 'invalid';
$row["msg"] = 'You have already registered, Please Login';
echo json_encode($row);
}
?>
|