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 : 18.191.26.149


Current Path : /proc/thread-self/root/var/www/html/univadmin/
Upload File :
Current File : //proc/thread-self/root/var/www/html/univadmin/gcg_smspush.php

<?php

	//include 'database.php';
	include("/var/www/config.php");
	$servername = SERVERNAME;
	$username   = USERNAME;
	$password  = PASSWORD;


	$conn = new  mysqli($servername,$username,$password);
	if(!$conn) 
	{
        die("Connection failed: " . mysqli_connect_error());
	}

	$commondb = "logisys3_comexam";
	ini_set('max_execution_time', 300);
	$sql = "select fdbname, funivcode,ffolder from {$commondb}.dbname where 
	ifnull(fdeleted,'') <> 'T' and ifnull(FEGOV,'') = 'T'
	and funivcode in('033')"; 
	$result = mysqli_query($conn,$sql);

	$result1 = 0;
	if($result)
	{		
		while($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
		{
			$db = $row['fdbname'];
			$univcode = $row['funivcode'];
			$ffolder = $row['ffolder'];

			$enttype = 'AB';

			$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno,fmobileno,fusertype,fenttype, fsubcode, fmessage, fstatus, fdeleted, fyear, fexamtype, fupdate,fexamdate)
			select distinct '{$univcode}', x.fregno,m.fmobileno,'S','AB', y.fqpcode,
			concat('From {$ffolder}: You have been marked as absent for the QP Code ', 
			concat(x.fqpcode, ', ',left(y.fsubname,20)),' exam held on ',
			date_format(x.fdoe,'%d/%m/%Y'),' - Uniclare') as fmessage,
			'F', 'F', x.fyear, x.fexamtype, now(),d.fexamdate
			from {$db}.absent x inner join {$db}.subject y
			on x.fqpcode = y.fqpcode and x.fdoe = y.fdoe 
			inner join {$db}.degree d on y.fdegree = d.fdegree and y.fexamno = d.fexamno
			inner join {$commondb}.masuser m on x.fregno = m.fregno 
			and m.funivcode = '{$univcode}'
			where ifnull(x.fabstype,-1) = 'QpA' and ifnull(x.fabsms,'F') <> 'T'";
			//var_dump($sql1);
			//die();
			$result1 = mysqli_query($conn, $sql1);
			
			if($result1)
			{
				$query = "update {$db}.absent x, {$db}.subject y set x.fabsms = 'T' 
				where x.fqpcode = y.fqpcode and x.fdoe = y.fdoe 
				and ifnull(x.fabstype,-1) = 'QpA'";
				$result4 = mysqli_query($conn, $query);
			}
			
			//Malpractice 
			
			$enttype = 'MP';

			$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno,fmobileno,fusertype,fenttype, fsubcode, fmessage, fstatus, fdeleted, fyear, fexamtype, fupdate,fexamdate)
			select distinct '{$univcode}', x.fregno,m.fmobileno,'S','MP', y.fqpcode,
			concat('Dear Student, you have been registered under malpratice for the QP Code ', 
			concat(x.fqpcode, ' - ',left(y.fsubname,20)),' examination held on ',
			date_format(x.fdoe,'%d/%m/%Y'),' - Uniclare') as fmessage,
			'F', 'F', x.fyear, x.fexamtype, now(),d.fexamdate
			from {$db}.absent x inner join {$db}.subject y
			on x.fqpcode = y.fqpcode and x.fdoe = y.fdoe 
			inner join {$db}.degree d on y.fdegree = d.fdegree 
			and y.fexamno = d.fexamno
			inner join {$commondb}.masuser m on x.fregno = m.fregno 
			and m.funivcode = '{$univcode}'
			where ifnull(x.fabstype,-1) = 'QpM' and ifnull(x.fabsms,'F') <> 'T'";
			$result2 = mysqli_query($conn, $sql1);
		
			if($result2)
			{
				$query = "update {$db}.absent x, {$db}.subject y set x.fabsms = 'T' 
				where x.fqpcode = y.fqpcode and x.fdoe = y.fdoe 
				and ifnull(x.fabstype,-1) = 'QpM'";
				$result3 = mysqli_query($conn, $query);
			}
			
			//Room Allotment From {$ffolder}: 

			$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno,fmobileno, fusertype,fenttype, fsubcode, fmessage, fstatus, fdeleted, fyear, fexamtype, fupdate,fexamdate)
			select distinct '{$univcode}', x.fregno,m.fmobileno,'S','RA', y.fqpcode ,  
			concat('From GCG: Dear Student, you have been allotted to room no. : ',
			if(ifnull(z.froomname,'') = '',
			ifnull(x.FHALLNO,''),concat(ifnull(z.froomname,''),' - ',x.fslno)), ' for the QP Code ',
			concat(y.fqpcode,' - ',left(y.fsubname,20)),' on ',
			date_format(y.fdoe,'%d/%m/%Y'),' ',w.FDESCPN,'',' - Uniclare') as fmessage,
			'F', 'F', x.fyear, x.fexamtype,now(),d.fexamdate
			from {$db}.canddet x inner join {$db}.subject y
			on  x.fdegree = y.fdegree and x.fexamno = y.fexamno and x.fsubcode = y.fsubcode 
			inner join {$db}.degree d on x.fdegree = d.fdegree and x.fexamno = d.fexamno
			inner join {$db}.candsum cs on cs.fcollcode = x.fcollcode
			
			and cs.fdegree = x.fdegree and cs.fregno = x.fregno
			and ifnull(cs.frecptdate,'')<>''
			inner join logisys3_comexam.masuser m on m.fregno = cs.fregno 
			and m.funivcode = '{$univcode}'	
			left join {$db}.masroom z on cs.fcntrcode = z.fcollcode 
			and x.FHALLNO = z.froomno
			left join {$db}.reason w on y.FSESSION = w.FREASONCD
			where ifnull(x.fpresent,'') = 'p' and ifnull(x.fpassmth,'') = ''
			and date_format(now(),'%Y-%m-%d') = date_format(y.fdoe,'%Y-%m-%d')
			and ifnull(y.FSESSION,'') like 'M%' and ifnull(x.fhallno,'') <> ''";
			$result1 = mysqli_query($conn, $sql1);

		}
	}
		
?>