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


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

<?php

	//include 'database.php';
	$servername = "logisys.cluster-cv9maxyrxjgg.ap-south-1.rds.amazonaws.com";
	$username   = "admin";
	$password  = "Logisys2104";

	$conn = new  mysqli($servername,$username,$password);
	if(!$conn) 
	{
        die("Connection failed: " . mysqli_connect_error());
	}
	//$enttype1 = $_GET['enttype'];

	$commondb = "logisys3_comexam";
	ini_set('max_execution_time', 3000);
	$sql = "select fdbname, funivcode from {$commondb}.dbname 
	where ifnull(FEGOV,'') = 'T'"; 
	$result = mysqli_query($conn,$sql);
	// var_dump($result);
	$result1 = 0;
	if($result)
	{		
		while($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
		{
			$db = $row['fdbname'];
			$univcode = $row['funivcode'];
			//IA marks insert
			$enttype = 'IA';
			
			$sql1 = "insert ignore into {$commondb}.pushnotif(funivcode, fcollcode, fregno, fmobileno,fmobappid,fdegree, fenttype, 
			fsubcode, ftitle, fbody, fstatus, fyear, fexamtype, fpushdate)
			select distinct '{$univcode}', x.fcollcode, x.fregno,fmobileno, FAPPMOBID, x.fdegree, '{$enttype}', '{$enttype}', 
			'IA Marks Available',
			CONCAT('Dear Student, IA marks is available for the ',d.fexamdate,' Examination.') as fbody, 'F', x.fyear, x.fexamtype, NOW()
			from {$db}.marks x inner join {$db}.collexam y
			on x.fdegree = y.fdegree and x.fexamno = y.fexamno and x.fcollcode = y.fcollcode
			inner join {$db}.degree d on x.fdegree = d.fdegree and x.fexamno = d.fexamno 
			inner join {$commondb}.masuser m on x.fregno = m.fregno 
			and m.funivcode = '{$univcode}'
			where IFNULL(x.fmarks,-1) <> -1
			and DATE_FORMAT(NOW(),'%Y-%m-%d') between DATE_ADD(y.fiato,INTERVAL 3 DAY) and 
			DATE_ADD(y.fiato,INTERVAL 30 DAY) 
			and IFNULL(y.FAPPIA,'F') <> 'T' 
			and x.fyear = d.FMEYEAR and x.fexamtype = d.FMEEXAMTYP";
			//var_dump($sql1);
			$result1 = mysqli_query($conn, $sql1);	
					
			if($result1)
			{	
			
				$sql1 = "update {$db}.marks x,{$db}.collexam y set FAPPIA = 'T' 
				where x.fdegree = y.fdegree and x.fexamno = y.fexamno 
				and x.fcollcode = y.fcollcode and ifnull(x.fmarks,-1) <> -1 
				and date_format(now(),'%Y-%m-%d') between y.fiato 
				and DATE_ADD(y.fiato,INTERVAL 30 DAY)";
				
				$result1 = mysqli_query($conn, $sql1);
			}
				
			$enttype = 'AB';

			$sql1 = "insert ignore into logisys3_comexam.pushnotif(funivcode, fcollcode, fregno,fmobileno,fmobappid,fcolor, fdegree, fenttype, fsubcode, ftitle, 
			fbody, fstatus, fyear, fexamtype, fpushdate)
			select distinct '{$univcode}',x.fcollcode, x.fregno,fmobileno, FAPPMOBID,'red', y.fdegree, '{$enttype}', y.fqpcode,
			CONCAT('Absent Entry - ',y.fqpcode) as ftitle,
			CONCAT('Dear Student, you are absent for the QP Code ', 
			CONCAT(x.fqpcode, ' - ',y.fsubname),' examination held on ',DATE_FORMAT(x.fdoe,'%d/%m/%Y')) as fbody,
			'F', x.fyear, x.fexamtype, NOW()
			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.fappab,'F') <> 'T'
			and x.fyear = d.FMEYEAR and x.fexamtype = d.FMEEXAMTYP ";
	
			$result1 = mysqli_query($conn, $sql1);	
			
			if($result1)
			{
				$query = "update {$db}.absent x, {$db}.subject y set x.fappab = 'T' 
							where  x.fqpcode = y.fqpcode and x.fdoe = y.fdoe 
							and ifnull(x.fabstype,-1) = 'QpA'
							and ifnull(y.fqpcode,'') <> '' and ifnull(y.fdoe,'0000-00-00') <> '0000-00-00'";
				$result1 = mysqli_query($conn, $query);
			}
			
			$enttype = 'MP';

			$sql1 = "insert ignore into logisys3_comexam.pushnotif(funivcode, fcollcode, fregno,fmobileno,fmobappid,fcolor, fdegree, fenttype, fsubcode, ftitle, 
			fbody, fstatus, fyear, fexamtype, fpushdate)
			select distinct '{$univcode}',x.fcollcode, x.fregno,fmobileno, FAPPMOBID,'red',y.fdegree, '{$enttype}', y.fqpcode,
			CONCAT('Malpractice - ',y.fqpcode) as ftitle,
			CONCAT('Dear Student, you are Malpractice for the QP Code ', 
			CONCAT(x.fqpcode, ' - ',y.fsubname),' examination held on ',DATE_FORMAT(x.fdoe,'%d/%m/%Y')) as fbody,
			'F', x.fyear, x.fexamtype, NOW()
			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.fappab,'F') <> 'T'
			and x.fyear = d.FMEYEAR and x.fexamtype = d.FMEEXAMTYP ";

			$result1 = mysqli_query($conn, $sql1);

			if($result1)
			{
				$query = "update {$db}.absent x, {$db}.subject y set x.fappab = 'T' 
							where  x.fqpcode = y.fqpcode and x.fdoe = y.fdoe 
							and ifnull(x.fabstype,-1) = 'QpM'
							and ifnull(y.fqpcode,'') <> '' and ifnull(y.fdoe,'0000-00-00') <> '0000-00-00'";
				$result1 = mysqli_query($conn, $query);
			}

			$enttype = "RA";

			$sql1 = "insert ignore into {$commondb}.pushnotif(funivcode, fcollcode, fregno, fmobileno,fmobappid,fdegree, fenttype, fsubcode, ftitle, 
			fbody, fstatus, fyear, fexamtype, fpushdate)
			select distinct '{$univcode}',x.fcollcode, x.fregno, fmobileno, FAPPMOBID, y.fdegree, '{$enttype}', y.fqpcode,  
			CONCAT('Room Allotment - ',y.fqpcode) as ftitle,
			CONCAT('Dear Student, you have been alloted to room no. : ',
			IF(IFNULL(z.froomname,'') = '',
			IFNULL(x.FHALLNO,''),IFNULL(z.froomname,'')), ' for the QP Code ',
			CONCAT(y.fqpcode,' - ',y.fsubname),' on ',
			DATE_FORMAT(y.fdoe,'%d/%m/%Y'),' (',w.FDESCPN,').',' All the best.') as fbody,
			'F', x.fyear, x.fexamtype,NOW()
			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 x.fcollcode = cs.fcollcode and x.fdegree = cs.fdegree
			and x.fregno = cs.fregno
			inner join {$commondb}.masuser m on cs.fregno = m.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 x.fyear = d.FMEYEAR and x.fexamtype = d.FMEEXAMTYP
			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);

		}
			
	}
?>