0xV3NOMx
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.148.105.127


Current Path : /proc/thread-self/root/var/www/oasis/src/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/src/createAdmission.php

<?php
include("sendsmsapi.php");
function savestudentdata($aobj_context)
{
	session_start();
	$fdegree     = trim($aobj_context->mobj_data["fdegree"]); 
	$femail      = trim($aobj_context->mobj_data["femail"]); 
	$fname       = trim($aobj_context->mobj_data["fname"]); 
	$fmobileno   = trim($aobj_context->mobj_data["fmobileno"]); 
	$catcode   = trim($aobj_context->mobj_data["catcode"]); 
	$fcombcode   = trim($aobj_context->mobj_data["fcombcode"]); 
	$fstudidno   = trim($aobj_context->mobj_data["fstudidno"]);
	$mode   = trim($aobj_context->mobj_data["mode"]); 
	$wom   = trim($aobj_context->mobj_data["wom"]); 
	$fcollcode   = $_SESSION['collcode'];
	$log_name    = $_SESSION['usr'];
	$randum      = mt_rand(1000000001,9999999999);

	if($fcollcode == '')
	{
		$arr = "Please login again and update.";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-2,"Failure"); 
		return;
	}	

	$query = "select fname, fcollcode, fdegree, fmobileno, ifnull(femail,'') as femail from collstud
	where fmobileno = '{$fmobileno}'";
	$sresult =  $aobj_context->mobj_db->GetRow($query); 
	
	if($wom == 'T')
		$sresult = false;

	if($sresult)
	{
		if($mode == 'edit')
		{
			$query = "update collstud set fname = '{$fname}',
			femail = '{$femail}',FCASTE = '{$catcode}',
			fcstudidno = '{$fstudidno}'
			where fmobileno = '{$fmobileno}'";
			$up_obj = $aobj_context->mobj_db->Execute($query);
			
			$query = "update studadm set fname = '{$fname}',
			femail = '{$femail}',FCASTE = '{$catcode}'
			where fcontact_no = '{$fmobileno}'";
			$up_obj = $aobj_context->mobj_db->Execute($query);

			$arr = "Updated Successfuly";
			echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
			return;
		}else
		{
			echo $aobj_context->mobj_output->ToJSONEnvelope($sresult,-1,"Failure"); 
			return;	
		}
		
	}
	else
	{
	
		$commondb = "logisys3_comexam";
		$category = '';

		if($wom == 'F')
		{	

			$query = "select a.fcollcode, a.fdegree, a.fcombcode, count(fmobileno) as fcount, 
			ifnull(b.fcombcode,'') as fcombcode, ifnull(b.fintake,0) as fintake from collcomb b 
			left join collstud  a on a.fcollcode = b.fcollcode and a.fdegree = b.fdegree 
			and a.fcombcode = b.fcombcode 
			where b.fcollcode = '{$fcollcode}'
			and b.fcombcode = '{$fcombcode}'
			and b.fdegree = '{$fdegree}'
			and ifnull(a.fdeleted,'') <> 'T'
			group by b.fcollcode,b.fdegree,b.fcombcode";
			//var_dump($query);
			$sresult =  $aobj_context->mobj_db->GetRow($query);
			

			// if($sresult['fcount']>=$sresult['fintake'])
			// {
			// 	$data = "Intake Exceeded for degree: ".$fdegree." Combination: ".$fcombcode." Contact College";
			// 	echo $aobj_context->mobj_output->ToJSONEnvelope($data,-2,"failure"); 
			// 	return;
			// }

			// if($sresult)
			// {
			// 	$data = "Intake Exceeded for degree: ".$fdegree." Combination: ".$fcombcode;
			// 	echo $aobj_context->mobj_output->ToJSONEnvelope($data,-2,"failure"); 
			// 	return;
			// }

			$query = "insert into tmpcollstud(fmobileno,fname,fdegree,fcollcode,femail,FCASTE,FCOMBCODE) 
			values ('{$fmobileno}','{$fname}','{$fdegree}','{$fcollcode}','{$femail}','{$catcode}','{$fcombcode}')";
			$up_obj = $aobj_context->mobj_db->Execute($query); 

			$query = "insert into collstud(fmobileno,fname,fdegree,fcollcode,femail,FCREATEDATE,FCREATEUSER,FCASTE,FCOMBCODE,fcstudidno) 
			values ('{$fmobileno}','{$fname}','{$fdegree}','{$fcollcode}','{$femail}',now(),'{$log_name}','{$catcode}','{$fcombcode}','{$fstudidno}')";
			$up_obj = $aobj_context->mobj_db->Execute($query); 


			$query = "select distinct FUNIVCODE, FUNIVNAME,FFOLDER,FSMSUSER,FSMSPASSWD,FSMSSENDID 
			from logisys3_comexam.dbname where funivcode = '{$_SESSION['FUNIVCODE']}'";
			$res = $aobj_context->mobj_db->GetRow($query);
			$FUNIVCODE = $res['FUNIVCODE'];
			$FUNIVNAME = $res['FUNIVNAME'];
			$FFOLDER = $res['FFOLDER'];
			$FSMSUSER = $res['FSMSUSER'];
			$FSMSPASSWD = $res['FSMSPASSWD'];
			$FSMSSENDID = $res['FSMSSENDID']; 

			$enttype = "AI{$fcollcode}";

			// $sql1 = "insert ignore into logisys3_comexam.sendsms(funivcode, fregno, fmobileno, 
			// fenttype, fsubcode, fmessage, fstatus, fdeleted, fyear, fexamtype,fupdate)
			// select distinct '{$FUNIVCODE}', x.fmobileno, x.fmobileno, '{$enttype}', '{$enttype}', 
			// concat('From {$FFOLDER}: Dear ', x.fname,', You are required to submit the admission details in online.',' Visit https://universitysolutions.in/','{$FFOLDER}','/adm', ' - Uniclare') as fmessage, 
			// 'F', 'F', '2020', '2', now() 
			// from collstud x  where ifnull(x.fsmspush,'') <> 'T' 
			// and x.fcollcode = '{$fcollcode}'
			// and x.fmobileno = '{$fmobileno}'
			// and ifnull(x.factive,'') <> 'T'";
			$sql1 = "insert ignore into logisys3_comexam.sendsms(funivcode, fregno, fmobileno, 
			fenttype, fsubcode, fmessage, fstatus, fdeleted, fyear, fexamtype,fupdate)
			select distinct '{$FUNIVCODE}', x.fmobileno, x.fmobileno, '{$enttype}', '{$enttype}', 
            concat('From ','{$FFOLDER}',': Dear ', x.fname, ', You are required to submit the admission details in online. Visit https://universitysolutions.in/','{$FFOLDER}','/adm/index.html - Uniclare') as fmessage, 
            'F', 'F', '2021', '2', now() 
			from collstud x  where ifnull(x.fsmspush,'') <> 'T' 
			and x.fcollcode = '{$fcollcode}'
			and x.fmobileno = '{$fmobileno}'
			and ifnull(x.factive,'') <> 'T'";

			//var_dump($sql1);
			//die();	
			$results = $aobj_context->mobj_db->Execute($sql1);

			

			$query = "select funivcode, fregno, fenttype, fmobileno as mobileno, 
			fmessage as fmessage
			from {$commondb}.sendsms 
			where ifnull(fstatus, 'F') = 'F' and fenttype = '{$enttype}' and funivcode = '{$FUNIVCODE}'
			and fmobileno is not null and fmobileno = '{$fmobileno}'";
	
			$sresult =  $aobj_context->mobj_db->GetAll($query); 
	
			foreach ($sresult as $key => $value) 
			{
				$to = $value['mobileno'];
				$text = $value['fmessage'];
				$smsresp = sendsmaapi($FSMSUSER,$FSMSPASSWD,$FSMSSENDID,$to,$text,$category); 	
				$rgInsert = "('".$value['funivcode']."','".$value['fregno']."','{$to}','0','{$smsresp}','".$value['fenttype']."','T', DATE_FORMAT(NOW(),'%Y-%m-%d'), DATE_FORMAT(NOW(),'%T'))";

				$strInsertQuery = "insert into {$commondb}.smslog(funivcode, fregno,fmobileno, freasoncode, fguid, fenttype, fstatus,fackdate, facktime) values".implode(',',$rgInsert);
			
				$ressql = $aobj_context->mobj_db->Execute($strInsertQuery);

				$strUpdateQuery = "update {$commondb}.sendsms set fstatus = 'T' where fenttype = '{$enttype}' and fmobileno = '{$to}'";
					
				$ressql = $aobj_context->mobj_db->Execute($strUpdateQuery);
				
				$strUpdateQuery = "update collstud set fsmspush = 'T' where fmobileno = '{$to}'";	
				$ressql = $aobj_context->mobj_db->Execute($strUpdateQuery);
			}
			
		}

		if($wom == 'T')
		{	
			$query = "insert into collstudnb(fmobileno,fname,fdegree,fcollcode,femail,FCREATEDATE,FCREATEUSER,fcstudidno) 
			values ('{$randum}','{$fname}','{$fdegree}','{$fcollcode}','{$femail}',now(),'{$log_name}','{$fstudidno}')";
			$up_obj = $aobj_context->mobj_db->Execute($query); 

		//	var_dump($query);
		}

		if($up_obj)
		{	
			$arr = "Updated Successfuly";
			echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
			return;
		}
		else
		{
			$arr = "Updation Failure";
			echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-2,"Failure"); 
			return;
		}	
	}

}

function loadDegComb($aobj_context)
{

	$fcollcode   = $_SESSION['collcode'];
	$log_name    = $_SESSION['usr'];
	

	if($fcollcode == '')
	{
		$arr = "Please login again and update.";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"); 
		return;
	}

	$fdegree     = trim($aobj_context->mobj_data["degcode"]); 

	$get_category_names="select c.fcombcode as internal_code, m.fcombdesc as value,c.fintake   
	from collcomb c inner join mascomb m on c.fdegree = m.fdegree
	and c.fcombcode = m.fcombcode 
	where c.fcollcode = '{$fcollcode}'
	and c.fdegree = '{$fdegree}'
	and ifnull(c.fdeleted,'') <> 'T'
	group by c.fdegree, c.fcombcode";
	 //echo $get_category_names; die();
	$lobj_get_category_names = $aobj_context->mobj_db->GetAll($get_category_names);
	if($lobj_get_category_names!= 0)	
      echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_category_names,0,"success"); 
    else
      echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_category_names,-1,"Failure");
    return;

}

function viewStuddet($aobj_context)
{

	$fdegree     = trim($aobj_context->mobj_data["fdegree"]); 
	//var_dump($fdegree." - : - ".$fcombcode);
	$fcollcode   = $_SESSION['collcode'];
	$log_name    = $_SESSION['usr'];
	
	if($fcollcode == '')
	{
		$arr = "Please login again and update.";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"); 
		return;
	}

	$query="select c.fmobileno,c.fname,c.fcaste,c.fcombcode,
	if(ifnull(s.ffinsub,'') = 'T',if(ifnull(s.FAPPSTATUS,'')='verified','Verified at college','Student submited. Verification Pending'),if(ifnull(s.FCONTACT_NO,'') <> '','Student final fubmission pending',if(ifnull(FACTIVE,'') = 'T','Student registered','Student not registered'))) as fstatus from collstud c
	left join studadm s on c.fmobileno = s.fcontact_no
	and c.fdegree = s.fdegree and c.fcollcode = s.fcollcode
	and ifnull(s.fdeleted,'') <> 'T'
	where c.fdegree = '{$fdegree}' and c.fcollcode = '{$fcollcode}'
	and ifnull(c.fdeleted,'') <> 'T'";
	 //echo $get_category_names; die();
	$results = $aobj_context->mobj_db->GetAll($query);
	if($results)	
  {    
		$data['studdata'] = $results;
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
	}	
	else
	{
		$data = "No Data Found";
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"Failure");
	}	
    return;

}


function deleteadmdata($aobj_context)
{

	$mob     = trim($aobj_context->mobj_data["mob"]); 
	//var_dump($fdegree." - : - ".$fcombcode);
	$fcollcode   = $_SESSION['collcode'];
	$log_name    = $_SESSION['usr'];
	
	if($fcollcode == '')
	{
		$arr = "Please login again and update.";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"); 
		return;
	}
	
	$query = "select * from studadm where fcontact_no = '{$mob}' and ifnull(FPAYSTATUS,'') = 'success'";
	$results = $aobj_context->mobj_db->GetRow($query);

	if($results)
	{
		$arr = "Student alerdy paid fee. it cant be deleted";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"); 
		return;

	}else
	{
		$query = "INSERT INTO delcollstud (FMOBILENO, FNAME, FDEGREE, FCOLLCODE, FCASTE, FCOMBCODE, FMOBILEOTP, FMOBOTPTIME, FOTPCOUNTER, FMOBILEVALID, FEMAIL, FEMAILOTP, FEMAILOTPTIME, FEMAILHASH, FEMAILVALID, FREGNO, FDOB, FADHARNO, FPARENTMOB, FPASSWD, FUNIVCODE, FACTIVE, FRESETOTP, FRESETOTPTIME, FRESETOTPCOUNT, FUPDTIME, FUPDATEUSER, FSMSPUSH, FCREATEDATE, FCREATEUSER, fslno, fdeleted,fdeletedate)
		select FMOBILENO, FNAME, FDEGREE, FCOLLCODE, FCASTE, FCOMBCODE, FMOBILEOTP, FMOBOTPTIME, FOTPCOUNTER, FMOBILEVALID, FEMAIL, FEMAILOTP, FEMAILOTPTIME, FEMAILHASH, FEMAILVALID, FREGNO, FDOB, FADHARNO, FPARENTMOB, FPASSWD, FUNIVCODE, FACTIVE, FRESETOTP, FRESETOTPTIME, FRESETOTPCOUNT, FUPDTIME, FUPDATEUSER, FSMSPUSH, FCREATEDATE, FCREATEUSER, fslno, fdeleted,now() from
		collstud where fmobileno = '{$mob}'";
		$res = $aobj_context->mobj_db->Execute($query);
		
		$query="delete from collstud where  fmobileno = '{$mob}'";
		$res = $aobj_context->mobj_db->Execute($query);

		if($res)	
		{
					
			$query = "INSERT INTO delstudadm (internal_code, FSLNO, FAREGNO, FCOLLCODE, FDEGREE, FEXAMNO, FCOMBCODE, FNAME, FFATNAME, FMOTNAME, FDOB, FPHOTOPATH, FSIGNPATH, FRELIGION, FSTUTYPE, FGENDER, FBLOOD_GROUP, FNATIONAL, FREGNO, FCASTE, FCATBIRTH, FAADHARNO, FAREA, FEMAIL, FCONTACT_NO, FMOBILE_NO, FINCOME, FMEDIUM, FQUOTA, FPERMADD1, FPERMADD2, FPERMADD3, FPERMADD4, FPERDIST, FPERSATE, FPERPINCODE, FCURRADD1, FCURRADD2, FCURRADD3, FCURRADD4, FCOMDIST, FCOMSTATE, FCOMPINCODE, FQULEXAM, FQUALEXREGNO, FUNIVNAME, FQMONTH, FQYEAR, FQMAXMARKS, FQSECMARKS, FQPERCENTAGE, FAYEAR, FFAT_OCC, FSEX, FENGLISH, FSUBDEGREE, FUSERID, FLOGNAME, FLOGDATE, FDELETED, FTOTFEE, FCONSTYPE, FRECNO, FRECDATE, FREMARKS, FXREGNO, FROLLNO, FNATCANDIDATE, FSTATE, FADMDATE, FTYPEQUALEXAM, FUNIVADD, FUNIVPHONE, FUNIVFEE, FUNIVRECNO, FAPPRSTATUS, FAPPRDATE, FAPPRUSERNAME, FAPPRUSERID, FPERCENT, FSECUREMARKS, FMAXMARKS, FPOB, FAPPNO, FAPPSTATUS, FACKDATE, FACKUSER, FCREATEDATE, FCREATEUSER, FADMFINE, FFINSUB, FSTUDID, fmot_occ, fhonours, FAPPRREMARKS, FNAREMARKS, fadmrnd, flateral_entry, fincomecert, fcastecert, fph, fapprpush, finalsub, FPAYREMARKS, FPAYID, FPAYSTATUS, FPAYDATE, FORDERID, FPAYTYPE,fdeleteddate)
			select internal_code, FSLNO, FAREGNO, FCOLLCODE, FDEGREE, FEXAMNO, FCOMBCODE, FNAME, FFATNAME, FMOTNAME, FDOB, FPHOTOPATH, FSIGNPATH, FRELIGION, FSTUTYPE, FGENDER, FBLOOD_GROUP, FNATIONAL, FREGNO, FCASTE, FCATBIRTH, FAADHARNO, FAREA, FEMAIL, FCONTACT_NO, FMOBILE_NO, FINCOME, FMEDIUM, FQUOTA, FPERMADD1, FPERMADD2, FPERMADD3, FPERMADD4, FPERDIST, FPERSATE, FPERPINCODE, FCURRADD1, FCURRADD2, FCURRADD3, FCURRADD4, FCOMDIST, FCOMSTATE, FCOMPINCODE, FQULEXAM, FQUALEXREGNO, FUNIVNAME, FQMONTH, FQYEAR, FQMAXMARKS, FQSECMARKS, FQPERCENTAGE, FAYEAR, FFAT_OCC, FSEX, FENGLISH, FSUBDEGREE, FUSERID, FLOGNAME, FLOGDATE, FDELETED, FTOTFEE, FCONSTYPE, FRECNO, FRECDATE, FREMARKS, FXREGNO, FROLLNO, FNATCANDIDATE, FSTATE, FADMDATE, FTYPEQUALEXAM, FUNIVADD, FUNIVPHONE, FUNIVFEE, FUNIVRECNO, FAPPRSTATUS, FAPPRDATE, FAPPRUSERNAME, FAPPRUSERID, FPERCENT, FSECUREMARKS, FMAXMARKS, FPOB, FAPPNO, FAPPSTATUS, FACKDATE, FACKUSER, FCREATEDATE, FCREATEUSER, FADMFINE, FFINSUB, FSTUDID, fmot_occ, fhonours, FAPPRREMARKS, FNAREMARKS, fadmrnd, flateral_entry, fincomecert, fcastecert, fph, fapprpush, finalsub, FPAYREMARKS, FPAYID, FPAYSTATUS, FPAYDATE, FORDERID, FPAYTYPE, now() from studadm
			where fcontact_no = '{$mob}'";
			$res = $aobj_context->mobj_db->Execute($query);

			$query="delete from studadm where fcontact_no = '{$mob}'";
			$res = $aobj_context->mobj_db->Execute($query);

			$data = "Deleted Successfully";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
		}	
		else
		{
			$data = "Update failure";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"Failure");
		}
	}	
    return;

}

function editadmdata($aobj_context)
{

	$mob     = trim($aobj_context->mobj_data["mob"]); 
	//var_dump($fdegree." - : - ".$fcombcode);
	$fcollcode   = $_SESSION['collcode'];
	$log_name    = $_SESSION['usr'];
	
	if($fcollcode == '')
	{
		$arr = "Please login again and update.";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"); 
		return;
	}
	
	$query = "select * from studadm where fcontact_no = '{$mob}' and ifnull(FPAYSTATUS,'') = 'success'";
	$results = $aobj_context->mobj_db->GetRow($query);

	if($results)
	{
		$arr = "Student alerdy paid fee. it cant be modified";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"); 
		return;

	}else
	{
		
		$query = "select * from collstud where fmobileno = '{$mob}'";
		$res = $aobj_context->mobj_db->GetRow($query);

		if($res)	
		{
			$data['data'] = $res;
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
		}	
		else
		{
			$data = "No Data Found";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"Failure");
		}
	}	
    return;

}
?>