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.220.110.45
<?php
include("sendzohomail.php");
require_once("phpqrcode-master/qrlib.php");
function getPriority($aobj_context){
$funivcode = $aobj_context->mobj_data['univcode'];
$fusertype = $_SESSION['USERTYPE'];
$femail = $_SESSION['MOBILE'];
$datatype = $aobj_context->mobj_data['datatype'];
if($datatype == 'Priority'){
$query = "select fid, ifnull(fpriority,'') as ftitle,
ifnull(fdeleted,'') as fdeleted from adm_maspriority";
}else if($datatype == 'Source'){
$query = "select fid,ifnull(fleadstatus,'') as ftitle,
ifnull(fdeleted,'') as fdeleted from adm_maslead";
}else if($datatype == 'Call'){
$query = "select fid,ifnull(fcallstatus,'') as ftitle,
ifnull(fdeleted,'') as fdeleted from adm_leadcallstatus";
}else if($datatype == 'Seat'){
$query = "select ifnull(FSEATTYPE,'') as fid,ifnull(FTYPEDESC,'') as ftitle,
ifnull(fdeleted,'') as fdeleted from adm_seattype";
}else if($datatype == 'State'){
$query = "select ifnull(FSEATSTATE,'') as fid,ifnull(FSTATEDESC,'') as ftitle,
ifnull(fdeleted,'') as fdeleted from adm_seatstate";
}
// var_dump($query);die();
$res = $aobj_context->pobj_db->GetAll($query);
if($res){
echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success");
return;
}else{
$arr['msg'] = "No data found";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function saveAgentDet($aobj_context){
$funivcode = $aobj_context->mobj_data['univcode'];
$fagtname = $aobj_context->mobj_data['fagtname'];
$fagtemail = $aobj_context->mobj_data['fagtemail'];
$fagtmobile = $aobj_context->mobj_data['fagtmobile'];
$fagtdegree = $aobj_context->mobj_data['fagtdegree'];
$add1 = $aobj_context->mobj_data['add1'];
$add2 = $aobj_context->mobj_data['add2'];
$add3 = $aobj_context->mobj_data['add3'];
$add4 = $aobj_context->mobj_data['add4'];
$agt_code = $aobj_context->mobj_data['agt_code'];
$fagttype = $aobj_context->mobj_data['fagttype'];
$fusertype = $_SESSION['USERTYPE'];
$femail = $_SESSION['MOBILE'];
$fdegree = str_replace(',','*',$fagtdegree);
if($fdegree == undefined)
$fdegree = '';
if($fagttype != 'edit'){
$que = "select ifnull(FAGCODE,'')as FAGCODE,ifnull(FEMAIL,'')as FEMAIL
from adm_agent where FAGCODE = '{$agt_code}' or FEMAIL = '{$fagtemail}'";
$res = $aobj_context->pobj_db->GetRow($que);
if($res['FAGCODE'] == $agt_code){
$cond = "Agent Code";
}else if($res['FEMAIL'] == $fagtemail){
$cond = "Email Id";
}
if(count($res) > 0){
$arr['msg'] = "This ".$cond." already exists";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
if($fagttype != 'edit'){
$query = "INSERT INTO adm_agent (FAGCODE, FAGNAME, FADDR1, FADDR2, FADDR3, FADDR4, FMOBILE, FEMAIL, FDEGPERM, FCREATEDATE,FCREATEUSER,FDELETED)
VALUES('{$agt_code}','{$fagtname}','{$add1}','{$add2}','{$add3}','{$add4}','{$fagtmobile}',
'{$fagtemail}','{$fdegree}',now(),'{$femail}','F')";
}else{
$query = "update adm_agent set FAGNAME = '{$fagtname}',FADDR1 = '{$add1}',
FADDR2 = '{$add2}', FADDR3 = '{$add3}', FADDR4 = '{$add4}',
FMOBILE = '{$fagtmobile}',FDELETED = 'F',and FUPDUSER = '{$femail}',FUPDDATE = now()
where FAGCODE = '{$agt_code}'";
}
$result = $aobj_context->pobj_db->Execute($query);
$que1 = "select ifnull(FINTNO,'')as FINTNO,
ifnull(FQRPATH,'')as FQRPATH,
ifnull(FAGCODE,'')as FAGCODE
from adm_agent where FAGCODE = '{$agt_code}'
and FEMAIL = '{$fagtemail}'";
$res1 = $aobj_context->pobj_db->GetRow($que1);
$fintno = $res1['FINTNO'];
$fagcode = $res1['FAGCODE'];
$FQRPATH = $res1['FQRPATH'];
if($result){
$colldet = "select ifnull(FUNIVNAME,'') as FUNIVNAME, concat(ifnull(FUNIVADD1,'') ,',', ifnull(FUNIVADD2,'')) as FUNIVADD,
ifnull(FTOWN,'') as FTOWN, ifnull(funivemail,'') as funivemail,
ifnull(funivmobile,'') as funivmobile, ifnull(fadmlink,'') as fadmlink
from control";
$collres = $aobj_context->pobj_db->GetRow($colldet);
$fcollname = $collres['FUNIVNAME'];
$fadmlink = $collres['fadmlink'];
$flink = explode('/',$fadmlink);
$funiname = explode('_',$flink[3]);
$fstdagt = $flink[2]."/index_".$funiname[1];
$agetlink = "https://".$flink[2]."/admin";
$characters = '0123456789';
$length = 10;
$password = '';
$url = "https://".$fstdagt."?a=".$fintno;
if($fagttype != 'edit'){
$file_name = $fintno.'.png';
$path = $aobj_context->main_src."uploads/".$file_name;
$filepath = $aobj_context->main_src."uploads/". $file_name;
generateQRCode($url, $filepath);
for ($i = 0; $i < $length; $i++) {
$password .= $characters[rand(0, strlen($characters) - 1)];
}
}else{
$agtqur = "select fpassword from adm_masuser where fusercode = '{$fagcode}'
and fusername = '{$fagtemail}'";
$agtres = $aobj_context->pobj_db->GetRow($agtqur);
$password .= $agtres['fpassword'];
$file_name = $FQRPATH;
}
$logo = "https://universitysolutions.in/admission/img/".$funivcode."_logo.jpg";
$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.="<div ><img src='{$logo}' height='100px' width='250px' /></div>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif; text-align:right'>Date.:"." $onldate "."</p>";
$message.="<p style='line-height: 0;'><b>Dear "."$fagtname".",</b></br></br></br></p>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
Respected Sir / Madam,</p>";
if($fagttype != 'edit'){
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
Your Account has been Created Successfully on Admission Portal.</p>";
}else{
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
Your Account has been Activated now on Admission Portal.</p>";
}
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
Here you can login to the portal: ".$agetlink."</p>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
Your Login ID : "."$fagtemail"."</p>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
Password : "."$password"."</p>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
Here is your referral link (Student can use this link to register using your referrence) : "."$url"."</p></br></br>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
Thanking You,</p>";
$message.="<b>".$fcollname."<b/><br>
</p>";
$message.="</body>";
$message.="</html>";
$subject= strtoupper($fcollname);
$qry10 = "select ifnull(femailkey, '')as femailkey, ifnull(FSUPEMAIL, '')as FSUPEMAIL
from logisys3_comexam.dbname where funivcode='{$funivcode}'";
$res10 = $aobj_context->pobj_db->GetRow($qry10);
// $resp = sendZohoMail($fagtemail, $subject, $message, $res10['femailkey'], $res10['FSUPEMAIL']);
if($fagttype != 'edit'){
$que1 = "INSERT INTO `adm_masuser` (fusercode, fname, fusername, fpassword, fusertype, fmobileno, fdegree, fdeleted)
VALUES('{$agt_code}','{$fagtname}','{$fagtemail}','{$password}','AG','{$fagtmobile}','{$fdegree}','F')";
$res1 = $aobj_context->pobj_db->Execute($que1);
$ques = "update adm_agent set FQRPATH = '{$file_name}'
where FINTNO = '{$fintno}'";
$resl = $aobj_context->pobj_db->Execute($ques);
}else{
$agentquery = "update adm_masuser set fdeleted = 'F'
where fusercode = '{$agt_code}'";
$masres = $aobj_context->pobj_db->Execute($agentquery);
}
}
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 generateQRCode($url, $filepath) {
// QR code configuration
$qrCodeConfig = [
'version' => 4, // QR Code version (1 to 40)
'eccLevel' => 'L', // Error correction level ('L', 'M', 'Q', 'H')
'imageType' => 'png', // Image type ('png', 'jpeg', 'gif', 'svg')
'outputType' => 'file', // Output type ('file', 'browser', 'return')
'file' => $filepath, // File path to save the QR code
'size' => 10 // Size of the QR code
];
// Generate QR code
$result = QRcode::png($url, $qrCodeConfig['file'], $qrCodeConfig['eccLevel'], $qrCodeConfig['size'], 2);
return $filepath;
}
function getAgentDet($aobj_context){
$funivcode = $aobj_context->mobj_data['univcode'];
$query = "select FINTNO,FAGCODE,FAGNAME,FMOBILE,FEMAIL,
FDEGPERM,ifnull(faddr1,'') as FADDR1,ifnull(faddr2,'') as FADDR2,
ifnull(faddr3,'') as FADDR3,ifnull(faddr4,'') as FADDR4,
if(ifnull(FDELETED,'') = 'F','T','F')as factiive
from adm_agent WHERE IFNULL(fdeleted, 'F') = 'F'";
$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 editAgentDet($aobj_context){
$funivcode = $aobj_context->mobj_data['univcode'];
$agentInt = $aobj_context->mobj_data['agentInt'];
$query = "select FINTNO,FAGCODE,FAGNAME,FMOBILE,FEMAIL,
FDEGPERM,ifnull(faddr1,'') as FADDR1,ifnull(faddr2,'') as FADDR2,
ifnull(faddr3,'') as FADDR3,ifnull(faddr4,'') as FADDR4
from adm_agent where FINTNO = '{$agentInt}'";
$result = $aobj_context->pobj_db->GetRow($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 deleteAgentDet($aobj_context){
$funivcode = $aobj_context->mobj_data['univcode'];
$fuserid = $aobj_context->mobj_data['agentInt'];
$agtcode = $aobj_context->mobj_data['agtcode'];
$query = "update adm_agent set FDELETED = 'T'
where FINTNO = '{$fuserid}'";
$result = $aobj_context->pobj_db->Execute($query);
$query1 = "update adm_masuser set FDELETED = 'T'
where fusercode = '{$agtcode}'";
$result1 = $aobj_context->pobj_db->Execute($query1);
if($result){
$arr['msg'] = "Delete Successfully";
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 getAgtStdData($aobj_context){
$funivcode = $aobj_context->mobj_data['univcode'];
$fdatype = $aobj_context->mobj_data['fdatype'];
$fusercode = $_SESSION['USERCODE'];
if($fdatype == 'Adm'){
$cond = ",ifnull(al.fpaymentdate,'') as fcreatedate";
$cond1 = "and ifnull(al.fpaymentdate,'') <> ''";
}else if($fdatype == 'App'){
$cond = ",ifnull(al.fappdate,'') as fcreatedate";
$cond1 = "";
}
if($fdatype == 'Reg'){
$query = "select ifnull(al.fleadid,'') as fleadid,ifnull(al.fappno,'') as fappno,
ifnull(al.fname,'') as fname,ifnull(al.fmobile,'') as fmobile,
ifnull(al.femail,'') as femail,ifnull(al.fcreateddate,'') as fcreatedate,
d.fdescpn,ifnull(al.fleadstatus,'') as fleadstatus
from adm_lead al
inner join degree d on al.fdegree = d.fdegree
where al.fagtcode = '{$fusercode}' and al.ftype = 'Registered'";
}else{
$query = "select ifnull(al.fleadid,'') as fleadid,ifnull(al.fappno,'') as fappno,
ifnull(al.fname,'') as fname,ifnull(al.fmobile,'') as fmobile,
ifnull(al.femail,'') as femail,d.fdescpn,
ifnull(al.fleadstatus,'') as fleadstatus
$cond
from adm_stud al
inner join degree d on al.fdegree = d.fdegree
inner join adm_studfee af on al.fdegree = af.fdegree and
al.fappno = af.fappno
where al.fagtcode = '{$fusercode}' and al.ftype = 'Applied'
$cond1";
}
$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 getAgtUrlQR($aobj_context){
$funivcode = $aobj_context->mobj_data['univcode'];
$fusercode = $_SESSION['USERCODE'];
$query = "select fintno,ifnull(fqrpath,'') as fqrpath
from adm_agent where fagcode = '{$fusercode}'";
// var_dump($query);die();
$result = $aobj_context->pobj_db->GetRow($query);
if($result){
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
return;
}else{
$arr['msg'] = "Something went wrong try later";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function saveCrtPriort($aobj_context){
$funivcode = $aobj_context->mobj_data['univcode'];
$datatype = $aobj_context->mobj_data['datatype'];
$findata = json_decode($aobj_context->mobj_data['findata']);
$fusercode = $_SESSION['USERCODE'];
$date = date("Y/m/d");
if($datatype == 'Priority'){
foreach($findata as $val){
$query = "INSERT INTO adm_maspriority (fid, fpriority, fcreatedate, fcreateuser, fdeleted)
VALUES ('{$val->fid}', '{$val->ftitle}', '{$date}', '{$fusercode}', '{$val->fdeleted}')
ON DUPLICATE KEY UPDATE
fpriority = '{$val->ftitle}', fupddate = '{$date}', fupduser = '{$fusercode}', fdeleted = '{$val->fdeleted}',
fid = '{$val->fid}'";
$result = $aobj_context->pobj_db->Execute($query);
}
}else if($datatype == 'Source'){
foreach($findata as $val){
$query = "INSERT INTO adm_maslead (fid, fleadstatus, fcreatedate, fcreateuser, fdeleted)
VALUES ('{$val->fid}', '{$val->ftitle}', '{$date}', '{$fusercode}', '{$val->fdeleted}')
ON DUPLICATE KEY UPDATE
fleadstatus = '{$val->ftitle}', fupddate = '{$date}', fupduser = '{$fusercode}', fdeleted = '{$val->fdeleted}',
fid = '{$val->fid}'";
$result = $aobj_context->pobj_db->Execute($query);
}
}else if($datatype == 'Call'){
foreach($findata as $val){
$query = "INSERT INTO adm_leadcallstatus (fid, fcallstatus, fcreatedate, fcreateuser, fdeleted)
VALUES ('{$val->fid}', '{$val->ftitle}', '{$date}', '{$fusercode}', '{$val->fdeleted}')
ON DUPLICATE KEY UPDATE
fcallstatus = '{$val->ftitle}', fupddate = '{$date}', fupduser = '{$fusercode}', fdeleted = '{$val->fdeleted}',
fid = '{$val->fid}'";
$result = $aobj_context->pobj_db->Execute($query);
}
}
if($result){
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
return;
}else{
$arr['msg'] = "Something went wrong try later";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function getSourceData($aobj_context){
$funivcode = $aobj_context->mobj_data['univcode'];
$query = "select fid,ifnull(fleadstatus,'') as ftitle,
ifnull(fdeleted,'') as fdeleted from adm_maslead";
$res = $aobj_context->pobj_db->GetAll($query);
if($res){
echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success");
return;
}else{
$arr['msg'] = "No data found";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function getPriorityData($aobj_context){
$funivcode = $aobj_context->mobj_data['univcode'];
$query = "select fid, ifnull(fpriority,'') as ftitle,
ifnull(fdeleted,'') as fdeleted from adm_maspriority";
$res = $aobj_context->pobj_db->GetAll($query);
if($res){
echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success");
return;
}else{
$arr['msg'] = "No data found";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function getCallStatus($aobj_context){
$funivcode = $aobj_context->mobj_data['univcode'];
$fusertype = $_SESSION['USERTYPE'];
$query = "select fid,ifnull(fcallstatus,'') as ftitle,
ifnull(fdeleted,'') as fdeleted from adm_leadcallstatus";
$res = $aobj_context->pobj_db->GetAll($query);
if($res){
echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success");
return;
}else{
$arr['msg'] = "No data found";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
?>
|