survey_seahorse

Software Engineering Project - Fall 2018
Log | Files | Refs | README

commit 18874a21b516100e26a733e84809ade8d6bd9979
parent 375ded34b682c592ab287d312507981d4510d09d
Author: John Kubach <johnkubach@gmail.com>
Date:   Wed, 19 Dec 2018 20:17:58 -0500

blocked status checking

fully implemented user blocking features

Diffstat:
Mwebsite/archive.php | 6++++++
Mwebsite/controlpanel.php | 2+-
Mwebsite/createsurvey.php | 5+++++
Mwebsite/directory.php | 32+++++++++++++++++++-------------
4 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/website/archive.php b/website/archive.php @@ -7,6 +7,12 @@ include 'res/navbar.php'; echo '<link rel="stylesheet" href="res/style.css">'; echo '<div class="survey-directory">'; +$block = $_SESSION['blocked']; +if ($block == 51) { + header("Location: res/nope.php"); + exit(); +} + $date = date("Y-m-d"); $sql = "SELECT COUNT(*) FROM survey WHERE expiration_date < '$date';"; $result = mysqli_query($connect, $sql); diff --git a/website/controlpanel.php b/website/controlpanel.php @@ -1,5 +1,5 @@ <?php -include_once 'res/config.php'; +include_once 'res/session.php'; include_once 'config.php'; if (!isset($_SESSION['admin'])) { diff --git a/website/createsurvey.php b/website/createsurvey.php @@ -2,9 +2,14 @@ include_once 'res/session.php'; include 'res/navbar.php'; +$block = $_SESSION['blocked']; + if(!isset($_SESSION['uid'])){ header("location: login.php?user=notloggedin"); exit; +} elseif ($block == 49 || $block == 50 || $block == 51) { + header("location: res/nope.php"); + exit; } ?> diff --git a/website/directory.php b/website/directory.php @@ -7,6 +7,12 @@ include 'res/navbar.php'; echo '<link rel="stylesheet" href="res/style.css">'; echo '<div class="survey-directory">'; +$block = $_SESSION['blocked']; +if ($block == 51) { + header("Location: res/nope.php"); + exit(); +} + $date = date("Y-m-d"); $sql = "SELECT COUNT(*) FROM survey WHERE expiration_date >= '$date';"; $result = mysqli_query($connect, $sql); @@ -44,25 +50,25 @@ while ($row = mysqli_fetch_assoc($result)) { $range = 3; if ($page > 1) { - echo " <a href='{$_SERVER['PHP_SELF']}?page=1'><<</a> "; - $prevpage = $page - 1; - echo " <a href='{$_SERVER['PHP_SELF']}?page=$prevpage'><</a> "; + echo " <a href='{$_SERVER['PHP_SELF']}?page=1'><<</a> "; + $prevpage = $page - 1; + echo " <a href='{$_SERVER['PHP_SELF']}?page=$prevpage'><</a> "; } for ($x = ($page - $range); $x < (($page + $range) + 1); $x++) { - if (($x > 0) && ($x <= $total_pages)) { - if ($x == $page) { - echo " [<b>$x</b>] "; - } else { - echo " <a href='{$_SERVER['PHP_SELF']}?page=$x'>$x</a> "; - } - } + if (($x > 0) && ($x <= $total_pages)) { + if ($x == $page) { + echo " [<b>$x</b>] "; + } else { + echo " <a href='{$_SERVER['PHP_SELF']}?page=$x'>$x</a> "; + } + } } if ($page != $total_pages) { - $nextpage = $page + 1; - echo " <a href='{$_SERVER['PHP_SELF']}?page=$nextpage'>></a> "; - echo " <a href='{$_SERVER['PHP_SELF']}?page=$total_pages'>>></a> "; + $nextpage = $page + 1; + echo " <a href='{$_SERVER['PHP_SELF']}?page=$nextpage'>></a> "; + echo " <a href='{$_SERVER['PHP_SELF']}?page=$total_pages'>>></a> "; } exit();