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.14.145.97
<?php
//function getOtpForChangePwd($aobj_context){
// require_once('/var/www/html/sms/sendsmsapiv1.php');
// include("/var/www/html/sms/sendGridMail.php");
// $email = 'anitassa354@gmail.com';
// $message="<html>";
// $message.="<body>";
// $message.="<style>";
// $message.=".mail_tbl td{text-align:left; padding:2px; font-size:12px;
// font-family: Verdana, Arial, Helvetica, sans-serif;}";
// $message.="</style>";
// $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
// Dear Student,</p></br>";
// $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
// Your Mobile OTP for Registration is ".rand(100000,999999)."</p></br>";
// $message.="</br>";
// $message.="</body>";
// $message.="</html>";
// $subject="Forgot Password Authentication";
// $resp = sendGridMail($email, $subject, $message);
// $data = json_decode($resp, true);
// $arr["mail"] = $data;
// }
// function getOtpForChangePwd($aobj_context){
// require_once('/var/www/html/sms/sendsmsapiv1.php');
// include("/var/www/html/sms/sendGridMail.php");
// $username=$aobj_context->mobj_data['username'];
// $userId=$aobj_context->mobj_data['userid'];
// $mobileNumber=$aobj_context->mobj_data['mobile'];
// $univcode=$aobj_context->mobj_data['univcode'];
// $univtype=$aobj_context->mobj_data['usertype'];
// $univname=$aobj_context->mobj_data['univname'];
// $oldpwd=$aobj_context->mobj_data['oldpassword'];
// $otp = rand(100000, 999999);
// $time = date("h:i A");
// $qry="SELECT fpassword FROM qp_masuser WHERE fregno='{$userId}' AND fmobileno='{$mobileNumber}' AND fusertype='{$univtype}'";
// $res = $aobj_context->mobj_db->GetRow($qry);
// if($res['fpassword'] == $oldpwd){
// $query="UPDATE qp_masuser
// SET fmobileotp='{$otp}',fmobotptime=NOW()
// WHERE fregno='{$userId}' AND fmobileno='{$mobileNumber}' AND fusertype='{$univtype}' and fpassword='{$oldpwd}'";
// $result = $aobj_context->mobj_db->Execute($query);
// }
// if($result){
// $smsotp="From {$univname}: Dear {$username}, your OTP for password reset is {$otp}. Sent at {$time}- Uniclare";
// $sms = new SMS($univcode, 'OTP');
// $sms->sendIndvidualSms($mobileNumber, $smsotp, '600', 'UG');
// $smsresp = 'OTP has been sent to your mobile';
// $row['msg'] = $smsresp;
// echo $aobj_context->mobj_output->ToJSONEnvelope($row, 0,"Success");
// }else{
// $row['msg']="Something Went Wrong";
// echo $aobj_context->mobj_output->ToJSONEnvelope($row, -1,"Failed");
// }
// }
// function checkOtpToChangePwd($aobj_context){
// $otp=$aobj_context->mobj_data['eotp'];
// $username=$aobj_context->mobj_data['username'];
// $userId=$aobj_context->mobj_data['userid'];
// $mobileNumber=$aobj_context->mobj_data['mobile'];
// $univcode=$aobj_context->mobj_data['univcode'];
// $univtype=$aobj_context->mobj_data['usertype'];
// $univname=$aobj_context->mobj_data['univname'];
// $query="SELECT fmobileotp FROM qp_masuser WHERE fregno='{$userId}' AND fmobileno='{$mobileNumber}' AND fusertype='{$univtype}'";
// $result = $aobj_context->mobj_db->GetRow($query);
// if($result['fmobileotp']==$otp){
// $row['msg']="Enter Password";
// echo $aobj_context->mobj_output->ToJSONEnvelope($row, 0,"Success");
// }else{
// $row['msg']="Something Went Wrong - Resend OTP";
// echo $aobj_context->mobj_output->ToJSONEnvelope($row, -1,"Failed");
// }
// }
// function toSaveNewPassword($aobj_context){
// $newPass=$aobj_context->mobj_data['newPass'];
// $username=$aobj_context->mobj_data['username'];
// $userId=$aobj_context->mobj_data['userid'];
// $mobileNumber=$aobj_context->mobj_data['mobile'];
// $univcode=$aobj_context->mobj_data['univcode'];
// $univtype=$aobj_context->mobj_data['usertype'];
// $univname=$aobj_context->mobj_data['univname'];
// $query=" UPDATE qp_masuser
// SET fpassword='{$newPass}'
// WHERE fregno='{$userId}' AND fmobileno='{$mobileNumber}' AND fusertype='{$univtype}' ";
// $result = $aobj_context->mobj_db->Execute($query);
// if($result){
// $row['msg']="Successfully Saved";
// echo $aobj_context->mobj_output->ToJSONEnvelope($row, 0,"Success");
// }else{
// $row['msg']="Something Went Wrong";
// echo $aobj_context->mobj_output->ToJSONEnvelope($row, -1,"Failed");
// }
// }
function checkOldPassword($aobj_context) {
include('/var/www/html/sms/sendsmsapiv1.php');
include("sendzohomail.php");
$univcode = $aobj_context->mobj_data['univcode'];
$oldpassword = $aobj_context->mobj_data['oldpassword'];
$mobile = $aobj_context->mobj_data['mobile'];
$usertype = $aobj_context->mobj_data['usertype'];
$query = "select fpassword, femail from qp_masuser where fmobileno = '{$mobile}' and fusertype = '{$usertype}'
and fpassword = '{$oldpassword}'";
$result = $aobj_context->mobj_db->GetRow($query);
$emailid = $result['femail'];
if($result['fpassword'] == $oldpassword){
$motpaswrd = rand(100000, 900000);
$query = "update qp_masuser set fresetotp='{$motpaswrd}', fresetotptime=now()
where fmobileno = '{$mobile}' and fusertype = '{$usertype}'
and fpassword = '{$oldpassword}'";
$resul = $aobj_context->mobj_db->Execute($query);
if($resul){
$qry = "select funivname, ifnull(fsmsprovider, 'vfirst')as fsmsprovider
from control";
$res = $aobj_context->mobj_db->GetRow($qry);
$univname = $res['funivname'];
$smsprovider = $res['fsmsprovider'];
$time = date("h:i A");
$smsotp="Dear user, Your OTP for QPMS Forgot Password is $motpaswrd - Logisys";
if($smsprovider === "vfirst"){
$sms = new SMS($univcode, 'OTP');
$semsend = $sms->sendIndvidualSms($mobile, $smsotp, '600', 'UG');
}else if($smsprovider === "onex"){
$smsotp = "Dear User, OTP for Software Registration is $motpaswrd - PMSOLU";
$api = "https://api.onex-aura.com/api/sms?";
$url = $api;
$url.= "key=hyCR3Tm7";
$url.= "&from=PMSOLU";
$text = urlencode($smsotp);
$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);
}
$qry10 = "select ifnull(femailkey, '')as femailkey, ifnull(FSUPEMAIL, '')as FSUPEMAIL from logisys3_comexam.dbname where funivcode='{$univcode}'";
$res10 = $aobj_context->mobj_db->GetRow($qry10);
$subject = strtoupper("$univname".": OTP for change Password");
$message="<html>";
$message.="<body>";
$message.="<p>From {$univname}: Dear User, your OTP for Reset your password is {$motpaswrd}. sent at {$time} - Uniclare</p>";
$message.="</body>";
$message.="</html>";
$resp = sendZohoMail($emailid, $subject, $message, $res10['femailkey'], $res10['FSUPEMAIL']);
if($semsend){
$arr['sms'] = 'OTP has been sent to your mobile';
$arr['msg'] = "Password Matched";
}
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
return;
}else{
$arr['msg'] = "Something went wrong please try later!!";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}else{
$arr['msg'] = "Incorrect Password";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function validatePwdOtp($aobj_context) {
$otp = $aobj_context->mobj_data['otp'];
$mobile = $aobj_context->mobj_data['mobile'];
$usertype = $aobj_context->mobj_data['usertype'];
$query = "select fresetotp from qp_masuser where fmobileno = '{$mobile}' and fusertype = '{$usertype}'";
$result = $aobj_context->mobj_db->GetRow($query);
if($result['fresetotp'] == $otp){
$arr['msg'] = "OTP Mactched";
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 changeNewPassword($aobj_context) {
$newPwd = $aobj_context->mobj_data['newPwd'];
$mobile = $aobj_context->mobj_data['mobile'];
$usertype = $aobj_context->mobj_data['usertype'];
$query = "update qp_masuser set fpassword='{$newPwd}' where fmobileno = '{$mobile}' and fusertype = '{$usertype}'";
$result = $aobj_context->mobj_db->Execute($query);
if($result){
$arr['msg'] = "Password Changed! Please re-login to confirm";
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;
}
}
?>
|