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.218.107.101
<?php
function uniclareGetStates($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query = "select distinct fstatecode, fstate from dbname where
ifnull(fdeleted,'') <> 'T' and ifnull(fegov,'') = 'T'";
$result = $aobj_context->mobj_db->GetAll($query);
if(count($result) > 0)
{
$arr['states'] = $result;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
else
{
$arr['msg'] = 'No States Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function uniclareGetUnivs($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$state = $aobj_context->mobj_data['statecode'];
$query = "select funivcode, funivname, fegov from dbname
where ifnull(fdeleted,'') <> 'T' and fstatecode = '{$state}'
and ifnull(fegov,'') = 'T'
order by forder";
$result = $aobj_context->mobj_db->GetAll($query);
if(count($result) > 0)
{
$arr['univs'] = $result;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
else
{
$arr['msg'] = 'No Univs Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function uniclareRemoveRegn($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$mobile = $aobj_context->mobj_data['mobile'];
$query = "update masuser set factive = 'F' where fmobileno = {$mobile}";
$result = $aobj_context->mobj_db->Execute($query);
if($result)
{
$arr['msg'] = 'Mobile no. deactivated';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
else
{
$arr['msg'] = 'Mobile no. cannot be deactivated';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function uniclareValidateRegno($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$regno = $aobj_context->mobj_data['regno'];
$univcode = $aobj_context->mobj_data['univ'];
$query = "SELECT fmobileno, femail from masuser
where fregno = '{$regno}' and funivcode = '{$univcode}' and factive = 'T'";
$result = $aobj_context->mobj_db->GetRow($query);
if(count($result) > 0)
{
$arr['msg'] = 'You have already registered with this Id';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
$query = "SELECT fname, ifnull(ffather,'') as ffather, ifnull(fmother,'') as fmother,
ifnull(fusertype,'600') as fusertype, date_format(fdob,'%d/%m/%Y') as fdob
from pushstud where fregno = '{$regno}' and funivcode = '{$univcode}'";
$result = $aobj_context->mobj_db->GetRow($query);
if(count($result) > 0)
{
$arr['studRegnInfo'] = $result;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
else
{
$arr['msg'] = 'Invalid Register No. / Teacher Code';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function uniclareValidateMob($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$mobile = $aobj_context->req_body['mobile'];
$emailid = $aobj_context->req_body['email'];
$regno = $aobj_context->req_body['regno'];
$univcode = $aobj_context->req_body['univ'];
$concatRegno = $univcode.''.$regno;
//and fmobileotp = '3313'
$query = "SELECT ifnull(sum(if(fmobileno = '{$mobile}',1,0)),0) as fmobexist,
ifnull(sum(if(femail = '{$emailid}',1,0)),0) as femailexist,
ifnull(sum(if(concat(funivcode,fregno) = '{$concatRegno}',1,0)),0) as fregexist
from masuser where (fmobileno = '{$mobile}' or femail = '{$emailid}'
or concat(funivcode,fregno) = '{$concatRegno}') and factive = 'T' limit 1 ";
$result = $aobj_context->mobj_db->GetRow($query);
if($result['fmobexist']=='0' && $result['femailexist']=='0' && $result['fregexist']=='0')
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0,"success");
}
else
{
$arr['msg'] = 'Mobile No. or Email Id is already registered';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function uniclareSendOTP($aobj_context)
{
include("/var/www/html/sms/sendsmsapiv1.php");
// include("sendGridMail.php");
include("sendzohomail.php");
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$mobile = $aobj_context->req_body['mobile'];
$emailid = $aobj_context->req_body['email'];
$regno = $aobj_context->req_body['regno'];
$univcode = $aobj_context->req_body['univ'];
$usertyp = $aobj_context->req_body['usertyp'];
$dob = $aobj_context->req_body['dob'];
$passwd = $aobj_context->req_body['password'];
$adharno = $aobj_context->req_body['adharno'];
$parmobile = $aobj_context->req_body['parmobile'];
if($usertyp == 'T'){
$typeuser = "900";
}else{
$typeuser = "600";
}
if($mobile == '' || $emailid == '' || $regno == '' || $univcode == '' || $passwd == '')
{
$arr['msg'] = 'Invalid Params.';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,1,"failure");
return;
}
$query = "select fmobileotp, femailotp from masuser where fmobileno = '{$mobile}'
and ROUND(time_to_sec((TIMEDIFF(NOW(), fmobotptime))) / 60) <= 5";
$result = $aobj_context->mobj_db->GetRow($query);
date_default_timezone_set('Asia/Kolkata');
$time = date("h:i A");
if(count($result) > 0)
{
//$arr['row'] = $row;
$motpaswrd = $result['fmobileotp'];
$emailotp = $result['femailotp'];
}
else
{
$motpaswrd = rand(100000, 900000); //strtoupper(substr(sha1(rand()), 0, 4));
// $emailotp = genEmailotp(6);
$emailotp = genEmailotp($motpaswrd);
}
// $username = 'logisyhttp';
// $password = 'Logis986';
// $from = 'UNISOL';
// $to = $mobile;
// $text = $smsotp;
// $category = '';
// //$arr['text'] = $text;
// $smsresp = sendsmaapi($username,$password,$from,$to,$text,$category);
$query1 = "select FFOLDER, fdbname from logisys3_comexam.dbname where funivcode = '{$univcode}'";
$res = $aobj_context->mobj_db->GetRow($query1);
$FFOLDER = $res['FFOLDER'];
$db = $res['fdbname'];
$qry = "select ifnull(fsmsprovider, 'vfirst')as fsmsprovider from {$db}.control";
$result = $aobj_context->mobj_db->GetRow($qry);
$fsmsprovider = $result['fsmsprovider'];
// $smsotp = "Dear User, OTP for Software Registration is $motpaswrd - PMSOLU";
// $sms = new SMS($univcode, 'UREG');
if($fsmsprovider === 'vfirst'){
$smsotp = "Dear user, Your OTP for QPMS Registration is $motpaswrd - Logisys";
$sms->sendIndvidualSms($mobile, $smsotp, '600', 'UREG');
}else if($fsmsprovider === 'onex'){
$sms->sendIndvidualSms($mobile, $smsotp, '600', 'UREG', 'hyCR3Tm7', '1707171885912346766');
}
$smsotp = "From $FFOLDER: Dear User, OTP for Registration is $motpaswrd. sent at {$time} - Uniclare";
// $smsotp = "Dear Student, Your mobile OTP for Registration is, $motpaswrd sent at {$time}";
$sms = new SMS($univcode, 'UREG');
$sms->sendIndvidualSms($mobile, $smsotp, '900', 'UREG');
$arr["sms"] = $smsresp;
$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'>From ". $FFOLDER .":Dear User,</p></br>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
Your Email OTP for Registration is ".$emailotp."</p></br>";
$message.="</br>";
$message.="</body>";
$message.="</html>";
$subject="Uniclare Authentication";
// $resp = sendGridMail($emailid,$subject,$message);
$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']);
$data = json_decode($resp, true);
$arr["mail"] = $data;
$query = "select fusertype from pushstud where fregno = '{$regno}' and funivcode = '{$univcode}'";
$result = $aobj_context->mobj_db->GetRow($query);
$usertype = $result['fusertype'];
if($univcode != '008')
$adharno = '';
$query = "insert into masuser(fmobileno, fmobileotp, fmobotptime,
femail, femailotp, femailotptime, fregno, fdob, funivcode, fpasswd,fadharno, fparentmob, fusertype)
values('$mobile','{$motpaswrd}', now(), '{$emailid}',
'{$emailotp}', now(), '{$regno}','{$dob}', '{$univcode}',
'{$passwd}','{$adharno}','{$parmobile}', '{$typeuser}')
ON DUPLICATE KEY UPDATE
fmobileno = '{$mobile}', fmobileotp = '{$motpaswrd}', fmobotptime = now(),
femail = '{$emailid}', femailotp = '{$emailotp}', femailotptime = now(),
fregno = '{$regno}', fdob = '{$dob}', funivcode = '{$univcode}',
fpasswd ='{$passwd}',fotpcounter = fotpcounter+1, fadharno = '{$adharno}',
fparentmob = '{$parmobile}', fusertype = '{$typeuser}'";
// var_dump($query);
$result = $aobj_context->mobj_db->Execute($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0,"success");
}
else
{
$arr['msg'] = 'Error While Registration.';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function uniclareSignUp($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$mobile = $aobj_context->req_body['mobile'];
$mobileotp = $aobj_context->req_body['motp'];
$emailotp = $aobj_context->req_body['eotp'];
$query = "SELECT * from masuser
where fmobileno = '{$mobile}'
and fmobileotp = '{$mobileotp}'
and femailotp = '{$emailotp}'
and ROUND(time_to_sec((TIMEDIFF(NOW(), fmobotptime))) / 60) <= 5";
$result = $aobj_context->mobj_db->GetRow($query);
if(count($result) == 0)
{
$arr['msg'] = 'Invalid OTP or OTP Time out';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
$query = "update masuser set femailvalid = 'T',
fmobilevalid = 'T', factive = 'T'
where fmobileno = '{$mobile}'";
$result = $aobj_context->mobj_db->Execute($query);
if($result)
{
$arr["msg"] = 'Sign Up Successful';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0,"success");
}
else
{
$arr['msg'] = 'Error While Sign UP';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
function genEmailotp($length)
{
// $emailotp = "";
// $characters = array_merge(range('A','Z'));
// $max = count($characters) - 1;
// for ($i = 0; $i < $length; $i++) {
// $rand = mt_rand(0, $max);
// $emailotp .= $characters[$rand];
// }
$emailotp = $length;
return $emailotp;
}
function getRegDegree($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$fstate = $aobj_context->mobj_data['fstate'];
$query = "SELECT * FROM college";
$result = $aobj_context->pobj_db->GetAll($query);
if ($result) {
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
return;
} else {
$arr['msg'] = "No data found";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function uniclareValidateCollCode($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$fstate = $aobj_context->mobj_data['fstate'];
$regcoll = $aobj_context->mobj_data['regcoll'];
$query = "SELECT fcollname, IFNULL(ftown,'') as ftowns, IFNULL(fprincipalname,'') AS fprinic,
IFNULL(fmobile,'') AS fmobil
FROM college where FCOLLCODE = '{$regcoll}'";
$result = $aobj_context->pobj_db->GetRow($query);
$mobile = $result['fmobil'];
$mob =substr($mobile, 0, 2) . "******" . substr($mobile,-2);
if ($result) {
$arr['fcollname'] = $result['fcollname'];
$arr['ftowns'] = $result['ftowns'];
$arr['fprinic'] = $result['fprinic'];
$arr['fmobil'] = $result['fmobil'];
$arr['maskmob'] = $mob;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
return;
} else {
$arr['msg'] = "No data found";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function sendRegOtp($aobj_context)
{
require_once('/var/www/html/sms/sendsmsapiv1.php');
error_reporting(E_ALL);
ini_set('display_errors', 'on');
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
date_default_timezone_set('Asia/Kolkata');
$time = date("h:i A");
$univcode = $aobj_context->mobj_data['univcode'];
$mobile = $aobj_context->mobj_data['mob'];
$regcoll = $aobj_context->mobj_data['regcoll'];
$pri = $aobj_context->mobj_data['pri'];
$getdb = "select funivname from logisys3_comexam.dbname where funivcode='{$univcode}'";
$resdb = $aobj_context->pobj_db->GetRow($getdb);
$univname = $resdb['funivname'];
$checkotp = "SELECT fmobileotp FROM logisys3_comexam.masuser WHERE
fmobileno='{$mobile}' AND
factive='F' AND ROUND(TIME_TO_SEC((TIMEDIFF(NOW(), fmobotptime))) / 60) <= 5";
$result = $aobj_context->pobj_db->GetRow($checkotp);
$active = "select FACTIVE from logisys3_comexam.masuser where fmobileno='$mobile'
and funivcode='{$univcode}'";
$resactive = $aobj_context->pobj_db->GetRow($active);
if($resactive['FACTIVE'] == 'T'){
$arr['msg'] = 'Already Registered';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1,"failure");
return;
}
if(count($result)>0){
$otp = $result['fmobileotp'];
date_default_timezone_set('Asia/Kolkata');
$time = date("h:i A");
$smsotp = "From {$univname}: Dear Student, OTP for Registration is $otp. sent at {$time} - Uniclare";
$sms = new SMS($univcode, 'OTP');
$sms->sendIndvidualSms($mobile, $smsotp, '600', 'UG');
$smsresp = 'Sent';
$row["sms"] = $smsresp;
echo $aobj_context->mobj_output->ToJSONEnvelope($row, 0,"OTP Re Sent");
return;
}else{
$otp = rand(1000, 9000);
$smsotp = "From {$univname}: Dear Student, OTP for Registration is $otp. sent at {$time} - Uniclare";
$sms = new SMS($univcode, 'OTP');
$sms->sendIndvidualSms($mobile, $smsotp, '600', 'UG');
$smsresp = 'Sent';
$row['sms'] = $smsresp;
$query = "select * from logisys3_comexam.masuser where fmobileno = '{$mobile}' and factive='F'";
$result = $aobj_context->pobj_db->GetRow($query);
if(count($result)>0)
{
$qry = "update logisys3_comexam.masuser set fmobileotp='{$otp}', fmobotptime=now()
where fmobileno='{$mobile}' and factive='F'";
}else{
$query = "INSERT INTO logisys3_comexam.pushstud (funivcode, fregno,fdegree, fcollcode, fname, fusertype)
VALUES('{$univcode}','{$regcoll}','{$regcoll}','{$regcoll}','$pri' ,'600')";
$result = $aobj_context->pobj_db->Execute($query);
$qry = "INSERT INTO logisys3_comexam.masuser (funivcode, fregno, fmobileotp,
fmobotptime, fmobileno, fusertype, factive, ftemp,ftype )
VALUES('{$univcode}','{$regcoll}','{$otp}',
now(), '{$mobile}', '600', 'F', 'C', 'C')";
}
$resultqry = $aobj_context->pobj_db->Execute($qry);
if($resultqry){
echo $aobj_context->mobj_output->ToJSONEnvelope($row, 0,"OTP Send");
return;
}else{
$arr['msg']='Something went wrong';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1,"failure");
return;
}
}
}
function saveDataRegTeach($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$regcoll = $aobj_context->mobj_data['regcoll'];
$pass = $aobj_context->mobj_data['pass'];
$otp = $aobj_context->mobj_data['otp'];
$mob = $aobj_context->mobj_data['mob'];
// var_dump($otp);
$query = "SELECT fmobileotp FROM logisys3_comexam.masuser WHERE
fmobileno='{$mob}' AND factive='F'
AND ROUND(TIME_TO_SEC((TIMEDIFF(NOW(), fmobotptime))) / 60) <= 5";
$result = $aobj_context->pobj_db->GetRow($query);
// var_dump($result['fmobileotp']);
// die();
if($result['fmobileotp'] != $otp){
$arr['msg'] = 'Invalid OTP or OTP Time out';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}else{
$inrtquery = "UPDATE logisys3_comexam.masuser SET fpasswd = '{$pass}' ,
factive = 'T', FUSERTYPE = '600' WHERE fmobileno = '{$mob}'";
$result1 = $aobj_context->pobj_db->Execute($inrtquery);
if ($result1) {
$arr['msg'] = 1;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
return;
} else {
$arr['msg'] = "Something Went Worng";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
}
#qpsettings
function validateRegno($aobj_context){
$usertype = $aobj_context->mobj_data['usertype'];
$regno = $aobj_context->mobj_data['regno'];
$query = "select * from qp_masuser where fregno='{$regno}'
and ifnull(factive, '') = 'T' and ifnull(fusertype, '')='T'";
$result = $aobj_context->mobj_db->GetAll($query);
if(count($result) > 0){
$arr['msg'] = "Teacher already registered";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
if($usertype == 'T'){
$query = "select fcollcode, fteachcode, fteachname, fgender,
date_format(fdob, '%d/%m/%Y')as fdob, fmobile, femail
from masteach where fteachcode='{$regno}'";
}
$result = $aobj_context->mobj_db->GetRow($query);
if($result){
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
}else{
$arr['msg'] = "No teacher code found";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function sendOtp($aobj_context){
require_once('/var/www/html/sms/sendsmsapiv1.php');
include("sendzohomail.php");
$payload = file_get_contents("php://input");
$data = json_decode($payload, true);
$query = "select * from qp_masuser where fmobileno='{$data['mobileNo']}'
and ifnull(factive, '') = 'T' and fusertype = 'T'";
$result = $aobj_context->mobj_db->GetAll($query);
if(count($result) > 0){
$arr['msg'] = "Mobile number already registered";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
$query = "select * from qp_masuser where fmobileno='{$data['mobileNo']}' and fusertype = 'T'";
$result = $aobj_context->mobj_db->GetAll($query);
$checkotp = "select fmobileotp from qp_masuser where
fmobileno='{$data['mobileNo']}' and
ifnull(factive, 'F')='F'
and round(time_to_sec((timediff(now(), fmobotptime))) / 60) <= 5";
$res = $aobj_context->mobj_db->GetRow($checkotp);
if($res){
$otp = $res['fmobileotp'];
}else{
$otp = rand(1000, 9000);
}
$query = "select funivcode, funivname, ifnull(fsmsprovider, 'vfirst')as fsmsprovider from control";
$result1 = $aobj_context->mobj_db->GetRow($query);
$time = date("h:i A");
$univname = $result1['funivname'];
$univcode = $result1['funivcode'];
$smsprovider = $result1['fsmsprovider'];
$smsotp = "From {$univname}: Dear User, OTP for Registration is {$otp}. sent at {$time} - Uniclare";
if(count($result) == 1){
$qry = "update qp_masuser set fmobileotp='{$otp}', femailotp='{$otp}', fpassword='{$data['password']}',
fmobotptime=now(), femailotptime=now() where
fmobileno='{$data['mobileNo']}' and fusertype='T'";
} else {
$qry = "insert into qp_masuser (fregno, fmobileno, fpassword, femail, fdob, fmobileotp, fmobotptime, femailotp, femailotptime, fusertype)
values ('{$data['regno']}', '{$data['mobileNo']}', '{$data['password']}', '{$data['emailId']}',
date_format('{$data['dob']}', '%Y-%m-%d'),
'{$otp}', now(), '{$otp}', now(), '{$data['usertype']}')";
}
$res = $aobj_context->mobj_db->Execute($qry);
if($res){
if($smsprovider === 'vfirst'){
$sms = new SMS($univcode, 'OTP');
$sms->sendIndvidualSms($data['mobileNo'], $smsotp, '900', 'UREG');
} else if(strtolower($smsprovider) === 'onex'){
$mobileno = $data['mobileNo'];
$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={$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);
}
$query1 = "select FFOLDER, fdbname from logisys3_comexam.dbname where funivcode = '{$univcode}'";
$res = $aobj_context->mobj_db->GetRow($query1);
$FFOLDER = $res['FFOLDER'];
$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'>From ". $FFOLDER .":Dear User,</p></br>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
Your Email OTP for Registration is ".$otp."</p></br>";
$message.="</br>";
$message.="</body>";
$message.="</html>";
$subject="Uniclare Authentication";
$email = $data['emailId'];
// $resp = sendGridMail($email,$subject,$message);
$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($email, $subject, $message, $res10['femailkey'], $res10['FSUPEMAIL']);
// $data = json_decode($resp, true);
// $arr["mail"] = $data;
$arr['otp'] = "";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
}else{
$arr['msg'] = "Something went wrong, try again later";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function registerUser($aobj_context){
$payload = file_get_contents("php://input");
$data = json_decode($payload, true);
$query = "select fmobileotp from qp_masuser where fmobileno='{$data['mobileNo']}'
and fregno='{$data['regno']}'";
$result = $aobj_context->mobj_db->GetRow($query);
if($result['fmobileotp'] != $data['otp']){
$arr['msg'] = "Invalid OTP";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
$qry = "update qp_masuser set factive='T' where fmobileno='{$data['mobileNo']}'
and fregno='{$data['regno']}'";
$res = $aobj_context->mobj_db->Execute($qry);
if($res){
$arr['msg'] = "Successfully registered!";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
}else{
$arr['msg'] = "failed to register";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
|