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


Current Path : /proc/thread-self/root/var/www/html/gfgcg/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/gfgcg/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"]); 
	$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
	{
		$univcode = '041';
		$db = 'logisys3_bcu';
		$commondb = "logisys3_comexam";
		$univcode = '041';
		$username = 'logisyhttp';
		$password = 'Logis986';
		$from = 'UNISOL';
		$category = '';

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

			$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno, fmobileno, 
			fenttype, fsubcode, fmessage, fstatus, fdeleted, fyear, fexamtype,fupdate)
			select distinct '{$univcode}', x.fmobileno, x.fmobileno, 'AI', 'AI', 
			concat('Message from Bengaluru Central University.',CHAR(13),'Dear ', x.fname, ', You are required to submit the admission details online within 3 days.',CHAR(13),'Visit http://universitysolutions.in/bcu/adm') as fmessage, 'F', 'F', '2018', '2', now() 
			from {$db}.collstud x 
			where ifnull(x.fsmspush,'') <> 'T' and x.fmobileno = '{$fmobileno}'";

			$ressql = $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 in('AI','AC') and funivcode = '{$univcode}'
			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($username,$password,$from,$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 = 'AI' 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;
		}	
	}

}

?>