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.226.180.253
Current Path : /var/www/oasis/jssun/adm/ |
| Current File : /var/www/oasis/jssun/adm/sendMobEmailOTP.php |
<?php
include ("database.php");
ini_set('display_errors', 'on');
//include("sendsmsapi.php");
include("sendsmsapi_onex_new.php");
$mobile = trim($_POST['mobile']);
$dob = trim($_POST['dob']);//password
$passwd = trim($_POST['password']);
$query = "select ifnull(fmobileotp,'') as fmobileotp
from collstud where fmobileno = '{$mobile}'
and ROUND(time_to_sec((TIMEDIFF(NOW(), fmobotptime))) / 60) <= 5";
$result = mysqli_query($conn,$query);
$count = mysqli_num_rows($result);
date_default_timezone_set('Asia/Kolkata');
$time = date("h:i A");
$univcode = $row['FUNIVCODE'];
$query1 = "select FFOLDER from control";
$result1 = mysqli_query($conn,$query1);
$row1 = $result1->fetch_assoc();
$FFOLDER = $row1['FFOLDER'];
var_dump($FFOLDER);
if($count > 0)
{
$row = mysqli_fetch_assoc($result);
$motpaswrd = $row['fmobileotp'];
//$smsotp = "From $FFOLDER: Dear Student, OTP for Registration is $motpaswrd. sent at {$time} - Uniclare";
$smsotp = "Dear User, OTP for Software Registration is $motpaswrd - PMSOLU";
//var_dump($smsotp);
//$smsotp = "Dear Student, Your mobile OTP for Registration is, {$motpaswrd} sent at {$time}";
}
else
{
$motpaswrd = rand(1000, 9000); //strtoupper(substr(sha1(rand()), 0, 4));
//$smsotp = "Dear Student, Your mobile OTP for Registration is {$motpaswrd} sent at {$time}";
//r$smsotp = "From $FFOLDER: Dear Student, OTP for Registration is $motpaswrd. sent at {$time} - Uniclare";
$smsotp = "Dear User, OTP for Software Registration is $motpaswrd - PMSOLU";
}
//$smsotp = "Dear User, OTP for Software Registration is $motpaswrd - PMSOLU";
//var_dump($smsotp);
$username = 'logisyhttp';
$password = 'Logis986';
$from = 'UNISOL';
$to = $mobile;
$text = $smsotp;
$category = '';
//$smsresp = sendsmaapi($username,$password,$from,$to,$text,$category);
$sms = new SMS($univcode, 'UREG');
$sms->sendIndvidualSms($mobile, $smsotp, '600', 'UREG', 'hyCR3Tm7', '1707171885912346766');
$arr["sms"] = $smsresp;
$query = "update collstud set fmobileotp = '{$motpaswrd}', fmobotptime = now(),
fdob = '{$dob}', fpasswd ='{$passwd}',fotpcounter = fotpcounter+1
where fmobileno = '{$mobile}'";
if(mysqli_query($conn,$query))
{
$arr["status"] = 'success';
}
else
{
$arr["status"] = 'error';
}
//$arr["email"] = $data['message'];
echo json_encode($arr);
?>
|