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.147.146
<?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('030')";
$result = mysqli_query($conn,$sql);
$result1 = 0;
if($result)
{
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
{
$db = $row['fdbname'];
$univcode = $row['funivcode'];
$ffolder = strtoupper($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', t.fqpcode ,
concat('From REVA: Dear Student, you have been allotted to room no. : ',
if(ifnull(z.froomname,'') = '',
ifnull(x.FHALLNO,''),ifnull(z.froomname,'')), ' for the QP Code ',
concat(t.fqpcode,' - ',left(y.fsubname,20)),' on ',
date_format(t.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
inner join {$db}.timetable t on y.fqpcode = t.fqpcode
and x.fbatch = t.fbatch
and cs.fdegree = x.fdegree and cs.fregno = x.fregno
and ifnull(cs.frecptdate,'')<>''
inner join {$commondb}.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 t.FSESSION = w.FREASONCD
where ifnull(x.fpresent,'') = 'p' and ifnull(x.fpassmth,'') = ''
#and ifnull(x.fcollcode,'') <> '5013'
and date_format(now(),'%Y-%m-%d') = date_format(t.fdoe,'%Y-%m-%d')
and ifnull(t.FSESSION,'') like 'M%' and ifnull(x.fhallno,'') <> ''";
$result1 = mysqli_query($conn, $sql1);
}
}
?>
|