query($sql); } if(isset($_GET['loading'])) { //Inclusion du template include('inc/loading.html'); //Fermeture de la page exit(); } //On vérifie si l'utilisateur recherche uniquement les nouveautées if(isset($_GET['rapide'])) { //On recherche les notifications $sql = "SELECT * FROM `notification` WHERE `ID_personne` = ? AND `vu` = 0 ORDER BY `ID` LIMIT 1"; $requete = $bdd->prepare($sql); $requete->execute(array($_SESSION['ID'])); ob_start(); if($notification = $requete->fetch()) { //Arrêt de la sécurité des erreurs! ob_end_clean(); //On met la notification en vu $sql = "UPDATE notification SET vu = 1 WHERE ID = ".$notification['ID']; $update = $bdd->query($sql); //We search the informations about the personn $info = cherchenomprenom($notification['ID_createur'], $bdd); //We show the notification echo corrige_caracteres_speciaux($info['prenom']." ".$info['nom']." ".$notification['message'])."\n"; } else { ob_end_clean(); } //Fermeture du curseur $requete->closeCursor(); //On quitte le script courant exit(); } //Searching the last notifications $notifications = searchnotification($_SESSION['ID'], $bdd, 10, 0, '0'); if(count($notifications) == 0) { echo "
Il n'y a rien à afficher pour le moment.
"; } else { //We show the notifications foreach($notifications as $show) { //We search the informations about the personn $info = cherchenomprenom($show['ID_createur'], $bdd); //We show the notification if($show['adresse'] != "") { if(preg_match('', $show['adresse'])) { $adresse = str_replace('page:', '', $show['adresse']); if(preg_match('', $show['adresse'])) { $adresse = str_replace("post:", "|", $adresse); $array_adresse = explode('|', $adresse); echo ""; } else { echo ""; } } elseif(preg_match('', $show['adresse'])) { $adresse = str_replace('private_chat:', '', $show['adresse']); echo ""; } else echo ""; } echo "
".avatar($show['ID_createur'], "./", 32, 32); echo ($show['vu'] == 0 ? "" : ""); echo corrige_caracteres_speciaux($info['prenom']." ".$info['nom']." ".$show['message']); echo ($show['vu'] == 0 ? "" : "") ; echo " vu
"; if($show['adresse'] != "") echo ""; } }