PHP Classes

File: app/scripts/cleanallnotifications.php

Recommend this page to a friend!
  Packages of VITOR GABRIEL M. DANTAS   Pleiades   app/scripts/cleanallnotifications.php   Download  
File: app/scripts/cleanallnotifications.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Pleiades
Application to implement an issue-tracking system
Author: By
Last change:
Date: 2 years ago
Size: 1,580 bytes
 

 

Contents

Class file image Download
<?php
session_start();
require __DIR__.'/../config.php';
include __DIR__.'/../scripts/status.php';
include __DIR__.'/../scripts/verifyauth.php';

if($_SESSION['DataNotifications']['CountNotifications']>=1){
    $QueryCleanNotifications = "UPDATE notifications SET visualizado='1' WHERE id_conta='".$_SESSION['DataAccount']['id']."' AND visualizado='0' ORDER BY data_notification DESC";
    $QueryCleanNotificationsExec = mysqli_query($CONNECTION_DB, $QueryCleanNotifications);

    /* Update Notifications */
    unset($_SESSION['DataNotifications']);
    $QueryNotifications = "SELECT descricao,tipo_notification FROM notifications WHERE visualizado='0' AND id_conta='".$_SESSION['DataAccount']['id']."' ORDER BY data_notification DESC";
    $QueryNotificationsExec = mysqli_query($CONNECTION_DB, $QueryNotifications);
    for($j=0; $j<mysqli_num_rows($QueryNotificationsExec); $j++){
        $DataTools = mysqli_fetch_assoc($QueryNotificationsExec);
        $_SESSION['DataNotifications'][$j][] = $DataTools['descricao'];
        $_SESSION['DataNotifications'][$j][] = $DataTools['tipo_notification'];
    }
    $_SESSION['DataNotifications']['CountNotifications'] = mysqli_num_rows($QueryNotificationsExec);
    /* Update Notifications */

    $Fallback = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '../pages/System.php';
    header("Location: {$Fallback}");
    exit();
}else{
    $Fallback = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '../pages/System.php';
    header("Location: {$Fallback}");
    exit();
}

mysqli_close($CONNECTION_DB);