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.117.11.13
<?php
function validateStdForgotMobileNo($aobj_context){
require_once('/var/www/html/sms/sendsmsapiv1.php');
include("sendzohomail.php");
$mobile = $aobj_context->mobj_data["mobile"];
$regno = $aobj_context->mobj_data["regno"];
$univcode = $aobj_context->mobj_data["univcode"];
if($regno != ""){
$cnd = "and fregno='{$regno}'";
}else{
$cnd = "";
}
if($mobile == '' || strlen(strtolower($mobile)) != 10){
$arr['msg'] = "Enter valid mobile number";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
$query = "select fdbname, femailkey, fsupemail from logisys3_comexam.dbname where funivcode='{$univcode}'";
$res = $aobj_context->mobj_db->GetRow($query);
$dbname = $res['fdbname'];
$supemail = $res['fsupemail'];
$emailkey = $res['femailkey'];
$query1 = "select fregno, fmobileno from logisys3_comexam.masuser where
funivcode='{$univcode}' and fmobileno='{$mobile}'
and ifnull(fusertype, '') = '900' $cnd
and ifnull(factive, '')='T'";
$res1 = $aobj_context->mobj_db->GetAll($query1);
if(count($res1) == 0){
$arr['msg'] = 'Mobile number not registered';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}else if(count($res1) > 1){
$arr['msg'] = 'Found Multiple Register Number Please Select Your Register Number';
$arr['data'] = $res1;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -2, "failure");
return;
}else{
$otp = rand(100000, 900000);
$query2 = "update logisys3_comexam.masuser set fresetotp='{$otp}', fresetotptime=now()
where funivcode='{$univcode}' and fmobileno='{$mobile}'
and ifnull(fusertype, '') = '900' {$cnd}
and ifnull(factive, '')='T'";
$res2 = $aobj_context->mobj_db->Execute($query2);
if($res2){
$query = "select funivcode, funivname, fsmsprovider from {$dbname}.control";
$result1 = $aobj_context->mobj_db->GetRow($query);
$univname = $result1['funivname'];
$smsprovider = $result1['fsmsprovider'];
$emailid = $res1[0]['FEMAIL'];
$time = date("h:i A");
if($smsprovider == 'vfirst'){
$smsotp = "From {$univname}: Dear User, OTP for Login is {$otp}. sent at {$time} - Logisys";
$sms = new SMS($univcode, 'OTP');
$sms->sendIndvidualSms($mobile, $smsotp, '900', 'UREG');
}else if($smsprovider == 'onex' && $mobile != '7353604921'){
$sms = "Dear User, OTP for Software Registration is $otp - 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={$mobile}";
$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);
}
$subject = strtoupper("$univname".": Forgot Password OTP");
$message="<html>";
$message.="<body>";
$message.="<p>From {$univname}: Dear User, OTP for Reset Password is {$otp}. sent at {$time} - Logisys</p>";
$message.="</body>";
$message.="</html>";
if($mobile != '7353604921'){
$resp = sendZohoMail($emailid, $subject, $message, $emailkey, $supemail);
}
$arr['msg'] = "OTP sent to mobile number / email id";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
return;
}else{
$arr['msg'] = 'Something went wrong! try again later';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
}
function studForgotPwdOtp($aobj_context){
$data = json_decode($aobj_context->mobj_data["data"], true);
$univcode = $aobj_context->mobj_data["univcode"];
$mobile = $data['mobile'];
$regno = $data['regno'];
$otp = $data['otp'];
if($regno != ""){
$cnd = "and fregno='{$regno}'";
}else{
$cnd = "";
}
$query = "select * from logisys3_comexam.masuser where
funivcode='{$univcode}' and fmobileno='{$mobile}' $cnd
and ifnull(fusertype, '') = '900' and fresetotp='{$otp}'";
$res = $aobj_context->mobj_db->GetAll($query);
if(count($res) > 0){
$arr['msg'] = 'OTP Verified';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
return;
}else{
$arr['msg'] = 'Invalid OTP';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function studForgotChangePWD($aobj_context){
$data = json_decode($aobj_context->mobj_data["data"], true);
$univcode = $aobj_context->mobj_data["univcode"];
$mobile = $data['mobile'];
$password = $data['password'];
$regno = $data['regno'];
$confirmPassword = $data['confirmPassword'];
if(strlen(strtolower($password)) < 8){
$arr['msg'] = 'Password should be atleast 8 characters';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
if($password !== $confirmPassword){
$arr['msg'] = 'Password and Confirm Password should be same';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
if($regno != ""){
$cnd = "and fregno='{$regno}'";
}else{
$cnd = "";
}
$query = "update logisys3_comexam.masuser set fpasswd='{$password}', factive='T'
where funivcode='{$univcode}' and fmobileno='{$mobile}' and ifnull(fusertype, '')='900'
$cnd";
$result = $aobj_context->mobj_db->Execute($query);
if($result){
$arr['msg'] = 'Password reset successful Please login to confirm';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
return;
}else{
$arr['msg'] = 'Password reset failed';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function verifyStudentCurrentPassword($aobj_context){
$univcode = $aobj_context->mobj_data["univcode"];
$mobileno = $aobj_context->mobj_data["mobileno"];
$regno = $aobj_context->mobj_data["regno"];
$currPassword = $aobj_context->mobj_data["currPassword"];
if($currPassword == ""){
$arr['msg'] = 'Invalid Password';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
$query = "select fpasswd from logisys3_comexam.masuser where
funivcode='{$univcode}' and fmobileno='{$mobileno}'
and fpasswd='{$currPassword}' and ifnull(fusertype, '')='900'
and factive='T' and fregno='{$regno}'";
$result = $aobj_context->mobj_db->GetRow($query);
if($result['fpasswd'] === $currPassword){
$arr['msg'] = 'Password is verified';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
return;
}else{
$arr['msg'] = 'Invalid Password';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function updateStudentPassword($aobj_context){
$univcode = $aobj_context->mobj_data["univcode"];
$mobileno = trim($aobj_context->mobj_data["mobileno"]);
$regno = trim($aobj_context->mobj_data["regno"]);
$data = json_decode($aobj_context->mobj_data["data"], true);
$newPassword = $data['newPassword'];
$confirmNewPassword = $data['confirmNewPassword'];
if(strlen(strtolower($newPassword)) < 8){
$arr['msg'] = 'Password should be atleast 8 characters';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
if($newPassword !== $confirmNewPassword){
$arr['msg'] = 'Password and Confirm Password should be same';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
$query = "update logisys3_comexam.masuser set fpasswd='{$newPassword}' where
funivcode='{$univcode}' and fmobileno='{$mobileno}'
and ifnull(fusertype, '')='900' and fregno='{$regno}'";
$result = $aobj_context->mobj_db->Execute($query);
if($result){
$arr['msg'] = 'Password Changed Successfully! Do you want to logout?';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
return;
}else{
$arr['msg'] = 'Failed to Reset Password! Try again later';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
?>
|