commit ea92fb1bd23df70e361dd4a9cde46c6ceede7861
parent a73a99c9ac0ee28245aec292d4428f4278572758
Author: John Kubach <johnkubach@gmail.com>
Date:   Wed, 19 Dec 2018 17:03:47 -0500
error checking
check if expiration date is on or before the current date
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/website/res/new-survey.php b/website/res/new-survey.php
@@ -20,6 +20,9 @@ if (isset($_POST['submit'])) {
     if (empty($title)) {
         header("Location: ../createsurvey.php?item=empty");
         exit();
+    } elseif (date("Y-m-d", strtotime($expire_date)) <= date("Y-m-d")) {
+        header("Location: ../createsurvey.php?date=expired");
+        exit();
     } else {
         $adj_file = file("txt/adjectives.txt");
         $adj_name = $adj_file[array_rand($adj_file)];
@@ -35,7 +38,7 @@ if (isset($_POST['submit'])) {
             one_shot)
             VALUES ($uid, '$code', '$title', '$user', '$description', 
             b'$type', '$number_questions', '$date', '$sql_expire', 
-            $one_shot);";
+            b'$one_shot');";
 
         mysqli_query($connect, $sql) or die(mysqli_error($connect));