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.224.64.51
<?php
//include 'database.php';
$servername = "97.74.228.93";
$username = "logisys3_logu";
$password = "Logisys@2106";
/*$servername = "server";
$username = 'root';
$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 from {$commondb}.dbname where ifnull(fdeleted,'') <> 'T'";
$result = mysqli_query($conn,$sql);
$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}.sendsms(funivcode, fregno, fenttype, fmessage, fstatus, fdeleted, fyear, fexamtype)
select distinct '{$univcode}', x.fregno, '{$enttype}',
'Dear Student, IA marks has been uploaded. Login to Student Portal http://studentportal.logisys.org to check', 'F', 'F', x.fyear, x.fexamtype
from {$db}.marks x inner join {$db}.collexam y
on x.fdegree = y.fdegree and x.fexamno = y.fexamno and x.fcollcode = y.fcollcode
where ifnull(x.fmarks,-1) <> -1
and date_format(now(),'%Y-%m-%d') between y.fiato and
DATE_ADD(y.fiato,INTERVAL 30 DAY) and ifnull(y.iapush,'F') = 'F'
and x.fyear = '2018' and x.fexamtype = '1'";
$result1 = mysqli_query($conn, $sql1);
$sql1 = "update {$db}.marks x,{$db}.collexam y, set fiapush = '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);
//Hall Ticket
$enttype = 'HT';
$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno, fenttype, fmessage, fstatus, fdeleted, fyear, fexamtype)
select distinct '{$univcode}', x.fregno, '{$enttype}',
'Dear Student, Hall Ticket is available at http://studentportal.logisys.org for download', 'F', 'F', x.fyear, x.fexamtype
from {$db}.candsum x inner join {$db}.collexam y
on x.fdegree = y.fdegree and x.fcollcode = y.fcollcode
inner join {$db}.student z
on x.fdegree = z.fdegree and x.fregno = z.fregno
where ifnull(x.frecptdate,'') <> ''
and date_format(now(),'%Y-%m-%d') between y.fhtfrom and y.fhtto
and x.fyear = '2018' and x.fexamtype = '1' and ifnull(z.fexamappblk,'') <> 'T'
and ifnull(z.fmp,'') <> 'T'";
$result1 = mysqli_query($conn, $sql1);
$sql1 = "update {$db}.candsum x,{$db}.collexam y, set fhtpush = 'T'
where x.fdegree = y.fdegree and x.fcollcode = y.fcollcode
and ifnull(x.frecptdate,'') <> ''
and date_format(now(),'%Y-%m-%d') between y.fhtfrom and y.fhtto";
$result1 = mysqli_query($conn, $sql1);
//Attendance
$enttype = 'AT';
$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno, fenttype, fmessage, fstatus, fdeleted, fyear, fexamtype)
select distinct '{$univcode}', x.fregno, '{$enttype}',
'Dear Student, Attendance details are available in Student Portal http://studentportal.logisys.org', 'F', 'F', x.fyear, x.fexamtype
from {$db}.attend x inner join {$db}.collexam y
on x.fdegree = y.fdegree and x.fexamno = y.fexamno and x.fcollcode = y.fcollcode
where ifnull(x.fper,-1) <> -1
and date_format(now(),'%Y-%m-%d') between y.fattto and DATE_ADD(y.fattto,INTERVAL 10 DAY)
and x.fyear = '2018' and x.fexamtype = '1'";
$result1 = mysqli_query($conn, $sql1);
$sql1 = "update {$db}.attend x,{$db}.collexam y, set fattpush = 'T'
where x.fdegree = y.fdegree and x.fexamno = y.fexamno
and x.fcollcode = y.fcollcode
and ifnull(x.fper,-1) <> -1
and date_format(now(),'%Y-%m-%d') between y.fattto
and DATE_ADD(y.fattto,INTERVAL 10 DAY)";
$result1 = mysqli_query($conn, $sql1);
//Absent
$enttype = 'AB';
$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno, fenttype, fmessage, fstatus, fdeleted, fyear, fexamtype)
select distinct '{$univcode}', x.fregno, 'AB',
concat('Dear Student, you are absent for the subject ', concat(x.fqpcode, ' - ',y.fsubname),' examination on ',date_format(x.fdoe,'%d/%m/%Y')) as fmessage,
'F', 'F', x.fyear, x.fexamtype
from {$db}.absent x inner join {$db}.subject y
on x.fqpcode = y.fqpcode and x.fdoe = y.fdoe
where ifnull(x.fabstype,-1) = 'QpA'
and x.fyear = '2018' and x.fexamtype = '1'";
$result1 = mysqli_query($conn, $sql1);
//Malpractice
$enttype = 'MP';
$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno, fenttype, fmessage, fstatus, fdeleted, fyear, fexamtype)
select distinct '{$univcode}', x.fregno, 'MP',
concat('Dear Student, you are booked under malpratice for the subject ', concat(x.fqpcode, ' - ',y.fsubname),' examination on ',date_format(x.fdoe,'%d/%m/%Y')) as fmessage,
'F', 'F', x.fyear, x.fexamtype
from {$db}.absent x inner join {$db}.subject y
on x.fqpcode = y.fqpcode and x.fdoe = y.fdoe
where ifnull(x.fabstype,-1) = 'QpM'
and x.fyear = '2018' and x.fexamtype = '1'";
$result1 = mysqli_query($conn, $sql1);
//Room Allotment
$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno, fenttype, fmessage, fstatus, fdeleted, fyear, fexamtype)
select distinct '003', x.fregno, 'RA',
concat('Dear Student, you have alloted to Room No. : ',
if(ifnull(z.froomname,'') = '',
ifnull(x.FHALLNO,''),ifnull(z.froomname,'')), ' for the subject ',
concat(y.fqpcode,' - ',y.fsubname),' on ',
date_format(y.fdoe,'%d/%m/%Y'),' at ', w.FDESCPN) as fmessage,
'F', 'F', x.fyear, x.fexamtype
from logisys3_kus.canddet x inner join logisys3_kus.subject y
on x.fdegree = y.fdegree and x.fexamno = y.fexamno and x.fsubcode = y.fsubcode
left join masroom z on x.fcollcode = z.fcollcode and x.FHALLNO = z.froomno
left join reason w on y.FSESSION = w.FREASONCD
where ifnull(x.fpresent,'') = 'p' and ifnull(x.fpassmth,'') = ''
and x.fyear = '2018' and x.fexamtype = '1'
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);
}
$sql1 = "update {$commondb}.sendsms x, {$commondb}.masuser y set x.fmobileno = y.fmobileno
where x.funivcode = y.funivcode and x.fregno = y.fregno and ifnull(x.fmobileno,'') = ''";
$result1 = mysqli_query($conn, $sql1);
}
if($result1)
{
$arr = "Updated Successfully";
echo json_encode($arr);
}else
{
$arr = "Updation Failed";
echo json_encode($arr);
}
?>
|