survey_seahorse

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

commit 392bc65a496ba2b1ead0350bb30d9ab40789c33a
parent b8616c999bf4d677d70c65fa7b68e3dedd0093b6
Author: John Kubach <johnkubach@gmail.com>
Date:   Wed, 19 Dec 2018 19:18:20 -0500

add session file

use include 'session.php' instead of 'session_start'

Diffstat:
Mwebsite/archive.php | 4+---
Mwebsite/controlpanel.php | 7++-----
Mwebsite/createsurvey.php | 5+++--
Mwebsite/directory.php | 4+---
Mwebsite/findsurvey.php | 3++-
Mwebsite/index.php | 4+---
Mwebsite/login.php | 2+-
Mwebsite/logout.php | 2+-
Mwebsite/passReset.php | 2+-
Mwebsite/profile.php | 2+-
Mwebsite/questions.php | 2+-
Mwebsite/res/admin-message.php | 4+---
Mwebsite/res/block.php | 5+----
Mwebsite/res/delete-survey.php | 6+-----
Mwebsite/res/login-user.php | 6+-----
Mwebsite/res/new-survey.php | 6+-----
Mwebsite/res/reset-pass.php | 5+----
Mwebsite/res/submit-questions.php | 6+-----
Mwebsite/res/submit-survey.php | 6+-----
Mwebsite/success.php | 2+-
Mwebsite/takesurvey.php | 14++++----------
21 files changed, 28 insertions(+), 69 deletions(-)

diff --git a/website/archive.php b/website/archive.php @@ -1,8 +1,6 @@ <html> <?php - session_start(); -ini_set('display_errors', 'On'); -error_reporting(E_ALL | E_STRICT); +include_once 'res/session.php'; include_once 'config.php'; include 'res/navbar.php'; diff --git a/website/controlpanel.php b/website/controlpanel.php @@ -1,10 +1,7 @@ <?php -session_start(); - -ini_set('display_errors', 'On'); -error_reporting(E_ALL | E_STRICT); - +include_once 'res/config.php'; include_once 'config.php'; + if (!isset($_SESSION['admin'])) { header("Location: res/nope.php"); exit(); diff --git a/website/createsurvey.php b/website/createsurvey.php @@ -1,6 +1,7 @@ -<?php include 'res/navbar.php'; +<?php +include_once 'res/session.php'; +include 'res/navbar.php'; -session_start(); if(!isset($_SESSION['uid'])){ header("location: login.php?user=notloggedin"); exit; diff --git a/website/directory.php b/website/directory.php @@ -1,8 +1,6 @@ <html> <?php - session_start(); -ini_set('display_errors', 'On'); -error_reporting(E_ALL | E_STRICT); +include_once 'res/session.php'; include_once 'config.php'; include 'res/navbar.php'; diff --git a/website/findsurvey.php b/website/findsurvey.php @@ -1,4 +1,5 @@ -<?php session_start(); +<?php +include_once 'res/session.php'; include_once 'config.php'; include 'res/navbar.php'; $sql = "SELECT access_code FROM survey ORDER BY RAND() LIMIT 1;"; diff --git a/website/index.php b/website/index.php @@ -1,7 +1,5 @@ <?php -ini_set('display_errors', 'On'); -error_reporting(E_ALL | E_STRICT); -session_start(); +include_once 'res/session.php'; include_once 'config.php'; $sql = "SELECT question_content FROM question ORDER BY RAND() LIMIT 1;"; $result = mysqli_query($connect, $sql) or die(mysqli_error($connect)); diff --git a/website/login.php b/website/login.php @@ -1,5 +1,5 @@ <?php -session_start(); +include_once 'res/session.php'; if (!empty($_GET)) { $_SESSION['login-sid'] = $_GET['sid']; } diff --git a/website/logout.php b/website/logout.php @@ -1,5 +1,5 @@ <?php -session_start(); +include_once 'res/session.php'; unset($_SESSION["uid"]); unset($_SESSION["email"]); unset($_SESSION["username"]); diff --git a/website/passReset.php b/website/passReset.php @@ -1,5 +1,5 @@ <?php -session_start(); +include_once 'res/session.php'; if(!empty($_GET)){ $_SESSION['login-sid'] = $_GET['sid']; } diff --git a/website/profile.php b/website/profile.php @@ -1,6 +1,6 @@ <html> <?php -session_start(); +include_once 'res/session.php'; include_once 'config.php'; if($_SESSION['username'] == null) header("Location: login.php"); diff --git a/website/questions.php b/website/questions.php @@ -1,6 +1,6 @@ <html> <?php -session_start(); +include_once 'res/session.php'; include 'res/navbar.php'; echo '<link rel="stylesheet" href="res/style.css">'; diff --git a/website/res/admin-message.php b/website/res/admin-message.php @@ -1,7 +1,5 @@ <?php -session_start(); -ini_set('display_errors', 'On'); -error_reporting(E_ALL | E_STRICT); +include_once 'session.php'; if (!empty($_POST['message'])) { $uid = $_SESSION['uid']; diff --git a/website/res/block.php b/website/res/block.php @@ -1,9 +1,6 @@ <?php -ini_set('display_errors', 'On'); -error_reporting(E_ALL | E_STRICT); - -session_start(); +include_once 'session.php'; include_once '../config.php'; $username = mysqli_real_escape_string($connect, $_POST['username']); diff --git a/website/res/delete-survey.php b/website/res/delete-survey.php @@ -1,10 +1,6 @@ <?php -ini_set('display_errors', 'On'); -error_reporting(E_ALL | E_STRICT); - -session_start(); - if (isset($_POST['delete-survey'])) { + include_once 'session.php'; include_once '../config.php'; $code = mysqli_real_escape_string($connect, $_POST['survey-code']); diff --git a/website/res/login-user.php b/website/res/login-user.php @@ -1,11 +1,7 @@ <?php -session_start(); -ini_set('display_errors', 'On'); -error_reporting(E_ALL | E_STRICT); - - if (isset($_POST['submit'])) { + include_once 'session.php'; include '../config.php'; $username = mysqli_real_escape_string($connect, $_POST['username']); diff --git a/website/res/new-survey.php b/website/res/new-survey.php @@ -1,10 +1,6 @@ <?php -ini_set('display_errors', 'On'); -error_reporting(E_ALL | E_STRICT); - -session_start(); - if (isset($_POST['submit'])) { + include_once 'session.php'; include_once '../config.php'; $title = mysqli_real_escape_string($connect, $_POST['title']); diff --git a/website/res/reset-pass.php b/website/res/reset-pass.php @@ -1,9 +1,6 @@ <?php -session_start(); -ini_set('display_errors', 'On'); -error_reporting(E_ALL | E_STRICT); - if(isset($_POST['reset'])){ + include_once 'session.php'; include '../config.php'; $email = mysqli_real_escape_string($connect, $_POST['email']); diff --git a/website/res/submit-questions.php b/website/res/submit-questions.php @@ -1,9 +1,5 @@ <?php -ini_set('display_errors', 'On'); -error_reporting(E_ALL | E_STRICT); -ini_set('session.cache_limiter','public'); -session_cache_limiter(false); -session_start(); +include_once 'session.php'; include_once '../config.php'; $questions = array(); diff --git a/website/res/submit-survey.php b/website/res/submit-survey.php @@ -1,9 +1,5 @@ <?php -ini_set('display_errors', 'On'); -error_reporting(E_ALL | E_STRICT); -ini_set('session.cache_limiter','public'); -session_cache_limiter(false); -session_start(); +include_once 'session.php'; include_once '../config.php'; if (isset($_POST['answers'])) { diff --git a/website/success.php b/website/success.php @@ -1,5 +1,5 @@ <?php -session_start(); +include_once 'res/session.php'; $sid = $_SESSION['sid']; $code = $_SESSION['code']; diff --git a/website/takesurvey.php b/website/takesurvey.php @@ -1,16 +1,10 @@ <?php -session_start(); if(!isset($_SESSION['uid'])){ header("location: login.php?user=notloggedin"); exit; } -ini_set('display_errors', 'On'); -error_reporting(E_ALL | E_STRICT); - -ini_set('session.cache_limiter','public'); -session_cache_limiter(false); - +include_once 'res/session.php'; include_once 'config.php'; include 'res/navbar.php'; @@ -105,7 +99,7 @@ if (empty($code)) { </select> "; echo "<p> <span id='demo'</span> </p>"; } - echo "<button name ='numeric' type = 'submit' value = 'Submit'/>"; + echo "<input type='submit' name ='numeric' type = 'submit' value = 'Submit'/>"; } elseif ($type == 49) { for($counter = 0; $counter < $number_questions; $counter++) { $sql = "SELECT question_content FROM question WHERE survey_id=$sid and question_number=$counter+1;"; @@ -118,7 +112,7 @@ if (empty($code)) { </select> "; echo "<p> <span id='demo'</span> </p>"; } - echo "<button name ='bool' type = 'submit' value = 'Submit'/>"; + echo "<intput type='submit' name ='bool' type = 'submit' value = 'Submit'/>"; } elseif ($type == 50) { for($counter = 0; $counter < $number_questions; $counter++) { $sql = "SELECT question_content FROM question WHERE survey_id=$sid and question_number=$counter+1;"; @@ -130,7 +124,7 @@ if (empty($code)) { </form> "; echo "<p> <span id='demo'</span> </p>"; } - echo "<button name ='text' type = 'submit' value = 'Submit'/>"; + echo "<input type='submit' name ='text' type = 'submit' value = 'Submit'/>"; } echo "</form>"; }