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.149.243.29
<?php
include("database.php");
include("commandb.php");
//session_start();
$UNIVCODE = $_SESSION['UNIVCODE'];
/*$query = "INSERT INTO menulog(funivcode,fdate,fattendance)
VALUES('{$UNIVCODE}',date_format(now(),'%Y-%m-%d'),1)
ON DUPLICATE KEY UPDATE fattendance = if(ifnull(fattendance,'') = '', 1,fattendance+1)";
$results = mysqli_query($conndb,$query);
$strUserLogQuery = "insert into userlog
(funivcode, fregno, fmobileno, fipadd, FREASONCODE, FDESCPN)
values ('{$_SESSION['UNIVCODE']}', '{$_SESSION['REGNO']}',
'{$_SESSION['MOBILE']}', '{$_SERVER['REMOTE_ADDR']}',
'ATMN', 'ATMN - {$_SESSION['REGNO']} Viewed Attendance')";
$result = mysqli_query($conndb,$strUserLogQuery);
*/
$regno = $_SESSION['REGNO'];
$screen = $_POST['screen'];
$dateQuery = "select DATE_FORMAT(NOW(),'%Y-%m-%d') as presentdate,
DATE_ADD(collexam.fattfrom, INTERVAL 80 DAY) AS FROMDATE,
DATE_FORMAT(collexam.fattto, '%Y-%m-%d') as lastdate,
DATE_SUB(collexam.fattto, INTERVAL 3 DAY) as bforelaste from collexam
where fcollcode = '{$_SESSION['COLLCODE']}'
and fdegree = '{$_SESSION['DEGREE']}'
and DATE_FORMAT(NOW(),'%Y-%m-%d') between DATE_SUB(collexam.fattto, INTERVAL 3 DAY)
AND DATE_ADD(collexam.fattto, INTERVAL 80 DAY)";
$dateResult = mysqli_query($conn,$dateQuery);
$count = mysqli_num_rows($dateResult);
if($count > 0)
{
$query = "select distinct st.fregno, st.fname, ad.fcollcode,
cl.fcollname, ad.fdegree,
de.fdescpn as degree, ad.fexamno, de.fexamname,
concat(de.fexamdate, ' Examination') as fexamdate, ad.fsubcode, su.fsubname,
concat(su.fsubshort, '-' , su.fshortname) as fsubshort,
ifnull(ad.ftotc,0) as ftotc, ifnull(ad.ftota,0) as ftota, ifnull(ad.fper,0) as fper
from attend ad
inner join college cl
on ad.fcollcode = cl.fcollcode
inner join degree de
on ad.fdegree = de.fdegree
and ad.fexamno = de.fexamno
inner join subject su
on ad.fdegree = su.fdegree
and ad.fexamno = su.fexamno
and ad.fsubcode = su.fcsubcode
inner join student st
on ad.fdegree = st.fdegree
and ad.fcollcode = st.fcollcode
and ad.fregno = st.fregno
where ad.fregno = '{$regno}'
order by ad.fsubcode";
$result = mysqli_query($conn,$query);
$count = mysqli_num_rows($result);
if($count > 0)
{
$i = 0;
while($row = mysqli_fetch_assoc($result))
{
$info['strRegno'] = $row['fregno'];
$info['strName'] = $row['fname'];
$info['strDegree'] = $row['degree'];
$info['strSemester'] = $row['fexamname'];
$info['strExam'] = $row['fexamdate'];
$examdate = $row['fexamdate'];
$subject[$i] = $row['fsubname'];
$subshort[$i] = $row['fsubshort'];
$percent[$i] = $row['fper'];
$subcode[$i] = $row['fsubcode'];
$conducted[$i] = $row['ftotc'];
$attended[$i] = $row['ftota'];
$i++;
}
$app['rgPerinfo'] = $info;
$app['subject'] = $subject;
$app['subshort'] = $subshort;
$app['conducted'] = $conducted;
$app['attended'] = $attended;
$app['subcode'] = $subcode;
$app['percent'] = $percent;
$app['status'] = 'success';
mysqli_close($conn);
mysqli_close($conndb);
echo json_encode($app);
}
else
{
$app['status'] = 'error';
mysqli_close($conn);
mysqli_close($conndb);
echo json_encode($app);
}
}
else
{
$app['status'] = 'dateError';
mysqli_close($conn);
mysqli_close($conndb);
echo json_encode($app);
}
?>
|