From 37f99eb093f97e75e3e9bdadd20018b87733ac8e Mon Sep 17 00:00:00 2001 From: root Date: Fri, 19 Apr 2019 15:44:25 -0400 Subject: [PATCH] Added Ack all Alerts and view alerts, you can now ack alerts now --- alerts.php | 23 +++++++++-------------- post.php | 31 +++++++++++++++++++++++++++++++ top_nav.php | 6 +++--- 3 files changed, 43 insertions(+), 17 deletions(-) diff --git a/alerts.php b/alerts.php index fbefa724..f27f77eb 100644 --- a/alerts.php +++ b/alerts.php @@ -15,8 +15,7 @@ Date Type Alert - Ack - Actions + Ack @@ -27,23 +26,19 @@ $alert_type = $row['alert_type']; $alert_message = $row['alert_message']; $alert_date = $row['alert_date']; - $alert_read = $row['alert_read']; + $alert_ack_date = $row['alert_ack_date']; ?> - + - - - + + + + + + diff --git a/post.php b/post.php index b26fa503..de264d93 100644 --- a/post.php +++ b/post.php @@ -347,6 +347,37 @@ if(isset($_GET['delete_category'])){ } +if(isset($_GET['alert_ack'])){ + + $alert_id = intval($_GET['alert_ack']); + + mysqli_query($mysqli,"UPDATE alerts SET alert_ack_date = CURDATE() WHERE alert_id = $alert_id"); + + $_SESSION['alert_message'] = "Alert Acknowledged"; + + header("Location: alerts.php"); + +} + +if(isset($_GET['ack_all_alerts'])){ + + $sql = mysqli_query($mysqli,"SELECT * FROM alerts ORDER BY alert_id DESC"); + + while($row = mysqli_fetch_array($sql)){ + $alert_id = $row['alert_id']; + $alert_ack_date = $row['alert_ack_date']; + + if($alert_ack_date = 0 ){ + mysqli_query($mysqli,"UPDATE alerts SET alert_ack_date = CURDATE() WHERE alert_id = $alert_id"); + } + } + + $_SESSION['alert_message'] = "Alerts Acknowledged"; + + header("Location: alerts.php"); + +} + if(isset($_POST['add_expense'])){ $date = strip_tags(mysqli_real_escape_string($mysqli,$_POST['date'])); diff --git a/top_nav.php b/top_nav.php index b0868e84..112e368b 100644 --- a/top_nav.php +++ b/top_nav.php @@ -26,10 +26,10 @@ 9+