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.219.23.150
<?php
function validateMobileNo($aobj_context){
require_once('/var/www/html/sms/sendsmsapiv1.php');
include("sendzohomail.php");
$mobileno = $aobj_context->mobj_data["fmobile"];
$time = date("h:i A");
$query = "select fmobileno, ifnull(femail,'')as femail
from qp_masuser where fmobileno='{$mobileno}'";
$result = $aobj_context->mobj_db->GetRow($query);
$query = "select fmobileotp, femail from qp_masuser where fmobileno = '{$mobileno}'
and ROUND(time_to_sec((TIMEDIFF(NOW(), fmobotptime))) / 60) <= 5";
$result1 = $aobj_context->mobj_db->GetRow($query);
if(count($result1) > 0){
$restOtp = $result1['fmobileotp'];
}else{
$restOtp = rand(100000, 900000);
}
if($result['fmobileno'] != NULL){
$fmobile = $result['fmobileno'];
$emailid = $result['femail'];
$query = "select funivcode, funivname,
ifnull(fsmsprovider, 'vfirst')as fsmsprovider from control";
$result1 = $aobj_context->mobj_db->GetRow($query);
$univname = $result1['funivname'];
$univcode = $result1['funivcode'];
$smsprovider = $result1['fsmsprovider'];
$smsotp = "Dear user, Your OTP for QPMS Forgot Password is $restOtp - Logisys";
$subject = strtoupper("$univname".": Login OTP");
$message="<html>";
$message.="<body>";
$message.="<p>From {$univname}: Dear User, your Email OTP for Reset your password
is {$restOtp}. sent at {$time} - Uniclare</p>";
$message.="</body>";
$message.="</html>";
try {
if($smsprovider === 'vfirst'){
$sms = new SMS($univcode, 'OTP');
$sms->sendIndvidualSms($mobileno, $smsotp, '900', 'UREG');
}else if($smsprovider === 'onex'){
$sms = "Dear User, OTP for Software Registration is $restOtp - PMSOLU";
$api = "https://api.onex-aura.com/api/sms?";
$url = $api;
$url.= "key=hyCR3Tm7";
$url.= "&from=PMSOLU";
$text = urlencode($sms);
$url.= "&body={$text}";
$url.= "&entityid=1701160750260327092";
$url.= "&to={$mobileno}";
$url.= "&templateid=1707171885912346766";
$session = curl_init($url);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
curl_close($session);
}
// $resp = sendGridMail($emailid, $subject, $message, $univcode);
$qry10 = "select ifnull(femailkey, '')as femailkey, ifnull(FSUPEMAIL, '')as FSUPEMAIL from logisys3_comexam.dbname where funivcode='{$univcode}'";
$res10 = $aobj_context->mobj_db->GetRow($qry10);
$resp = sendZohoMail($emailid, $subject, $message, $res10['femailkey'], $res10['FSUPEMAIL']);
$updqur = "update qp_masuser set fmobileotp = '{$restOtp}',fmobotptime = now()
where fmobileno='{$mobileno}'";
$res = $aobj_context->mobj_db->Execute($updqur);
$arr['msg'] = 'OTP sent to your Mobile No. and Email id';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0,"success");
return;
} catch (\Throwable $th) {
$arr['msg'] = 'Failed to send otp';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}else{
$arr['msg'] = 'Failed to send otp';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
}
if($result){
echo $aobj_context->mobj_output->ToJSONEnvelope($result, -1, "failure");
return;
}else{
$arr['msg'] = 'Something went wrong! Try later';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function verifyOtp($aobj_context){
$mobileno = $aobj_context->mobj_data["fmobile"];
$fotp = $aobj_context->mobj_data["fotp"];
$query = "select ifnull(fmobileotp,'')as fmobileotp
from qp_masuser where fmobileno='{$mobileno}'";
$result = $aobj_context->mobj_db->GetRow($query);
if($result['fmobileotp'] == $fotp){
$arr['msg'] = "OTP Verify Successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "failure");
return;
}else{
$arr['msg'] = 'Enter valid OTP';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function saveNewPassword($aobj_context){
$mobileno = $aobj_context->mobj_data["fmobile"];
$fnewpaswd = $aobj_context->mobj_data["fnewpaswd"];
$updqur = "update qp_masuser set fpassword = '{$fnewpaswd}'
where fmobileno='{$mobileno}'";
$result = $aobj_context->mobj_db->Execute($updqur);
if($result){
$arr['msg'] = "New Password updated Successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "failure");
return;
}else{
$arr['msg'] = 'Enter valid OTP';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
?>
|