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.28.200
<?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());
}
$commondb = "logisys3_comexam";
ini_set('max_execution_time', 300);
$sql = "select fdbname, funivcode from {$commondb}.dbname where
ifnull(fdeleted,'') <> 'T' and ifnull(FEGOV,'') = 'T'
and funivcode in('027')";
$result = mysqli_query($conn,$sql);
$result1 = 0;
if($result)
{
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
{
$db = $row['fdbname'];
$univcode = $row['funivcode'];
$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('Dear Student, you are absent for the QP Code ',
concat(x.fqpcode, ' - ',left(y.fsubname,30)),' examination held on ',
date_format(x.fdoe,'%d/%m/%Y')) 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'";
$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,30)),' examination held on ',
date_format(x.fdoe,'%d/%m/%Y')) 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
$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('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,' - ',left(y.fsubname,30)),' on ',
date_format(y.fdoe,'%d/%m/%Y'),' (',w.FDESCPN,').') 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 {$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 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);
}
}
?>
|