first commit

This commit is contained in:
2024-04-19 14:04:41 +07:00
commit 014283036f
7282 changed files with 1324127 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
<?php
session_start();
include("core/main.php");
if($_GET['checkNum']){ // if your load with ?checkNum=1 you just want to check if there is anything new (this is for optimization)
$q = $db->query("select count(*) as nb from t_notification where status is null AND roles = ".$_SESSION['ROLES']);
$r = $q->fetchAll()[0];
echo $r['nb'];
} else { // otherwhise you want to load the info about the newest notification to display and set the status to 1 so it wont be displayed again
$q = $db->query("select * from t_notification where status is null AND roles = ".$_SESSION['ROLES']." order by id limit 1");
$r = $q->fetchAll()[0];
$db->query("update t_notification set status = 1 WHERE roles = ".$_SESSION['ROLES']."");
echo $r['info'];
}
?>