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.145.152.49


Current Path : /var/www/html/bcu/src/
Upload File :
Current File : /var/www/html/bcu/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"]); 
	$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)
	{
		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 collstud a 
			left join collcomb b on a.fcollcode = b.fcollcode and a.fdegree = b.fdegree 
			and a.fcombcode = b.fcombcode 
			where a.fcollcode = '{$fcollcode}'
			and a.fcombcode = '{$fcombcode}'
			and a.fdegree = '{$fdegree}'
			and ifnull(a.fdeleted,'') <> 'T'
			group by a.fcollcode,a.fdegree,a.fcombcode
			having fcount >= ifnull(fintake,0)";
			$sresult =  $aobj_context->mobj_db->GetAll($query);
			
			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) 
			values ('{$fmobileno}','{$fname}','{$fdegree}','{$fcollcode}','{$femail}',now(),'{$log_name}','{$catcode}','{$fcombcode}')";
			$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('{$FUNIVNAME}',' :',CHAR(13),'Dear ', x.fname, ', 
			You are required to submit the admission details in online.',CHAR(13),'
			Visit http://universitysolutions.in/','{$FFOLDER}','/adm') 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'";

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

			

			$query = "select funivcode, fregno, fenttype, fmobileno as mobileno, 
			concat(fmessage,' Sent Time: ',time(now())) 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) 
			values ('{$randum}','{$fname}','{$fdegree}','{$fcollcode}','{$femail}',now(),'{$log_name}')";
			$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}'
	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="update collstud set fdeleted = 'T' where  fmobileno = '{$mob}'";
  $res = $aobj_context->mobj_db->Execute($query);
	if($res)	
  {    
		$query="update studadm set fdeleted = 'T' where  fcontact_no = '{$mob}'";
		$res = $aobj_context->mobj_db->Execute($query);

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

}
?>