survey_seahorse

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

commit bd7bd58f75779d8d624da344d2933677fbfc0449
parent 060ac925677a3649add1ac0be5c196f5ccae9bed
Author: John Kubach <johnkubach@gmail.com>
Date:   Mon, 17 Dec 2018 14:01:33 -0500

add placeholder css

Diffstat:
Mwebsite/createsurvey.php | 1+
Mwebsite/directory.php | 6++++++
Mwebsite/login.php | 2+-
Mwebsite/profile.php | 44++++++++++++++++++++++++++++++--------------
Mwebsite/questions.php | 11++++++++---
Mwebsite/res/style.css | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mwebsite/res/submit-survey.php | 3+++
Mwebsite/signup.php | 1+
Mwebsite/takesurvey.php | 7++++++-
9 files changed, 116 insertions(+), 19 deletions(-)

diff --git a/website/createsurvey.php b/website/createsurvey.php @@ -1,5 +1,6 @@ <?php include 'res/navbar.php';?> <html> +<link rel="stylesheet" href="res/style.css"> <h2> Create A New Survey </h2> <form class="create-survey-form" action="res/new-survey.php" method="POST"> diff --git a/website/directory.php b/website/directory.php @@ -1,9 +1,13 @@ +<html> <?php ini_set('display_errors', 'On'); error_reporting(E_ALL | E_STRICT); include_once 'config.php'; include 'res/navbar.php'; +echo '<link rel="stylesheet" href="res/style.css">'; +echo '<div class="survey-directory">'; + $sql = "SELECT * FROM survey;"; $result = mysqli_query($connect, $sql); @@ -21,3 +25,5 @@ while ($row = mysqli_fetch_array($result)) { } exit(); ?> +</div> +</html> diff --git a/website/login.php b/website/login.php @@ -11,7 +11,7 @@ if (!empty($_GET)) { <form class="signin-form" action="res/login-user.php" method="POST"> <h2> Sign In</h2> <input type="text" name="username" placeholder="User Name"> - <input type="text" name="password" placeholder="Password"> + <input type="password" name="password" placeholder="Password"> <button type="submit" name="submit">Sign In</button> <br> <a href = "passReset.php" >Forgot your password?</a> <br> <a href = "signup.php" >Don't have an account?</a> diff --git a/website/profile.php b/website/profile.php @@ -1,5 +1,5 @@ +<html> <?php - session_start(); include_once 'config.php'; @@ -12,24 +12,40 @@ $block = $_SESSION['blocked']; $blockStatus = ""; if($block == 48) - $blockStatus = "full access"; + $blockStatus = "full access"; if($block == 49) - $blockStatus = "reduced access"; + $blockStatus = "reduced access"; if($block == 50) - $blockStatus = "you shouldn't even be here"; + $blockStatus = "you shouldn't even be here"; include 'res/navbar.php'; -$sql = "SELECT title FROM survey WHERE survey_id IN (SELECT survey_id FROM answer_numeric WHERE user_id=$uid);"; - $result = mysqli_query($connect, $sql); - $surveys_taken = mysqli_fetch_assoc($result); - echo "Surveys that ", $user, " has taken: ", $surveys_taken['title'], "<br>"; -?> +echo '<link rel="stylesheet" href="res/style.css">'; +echo '<div class="profile">'; + + +echo "<h2> Username: '$user' </h2>"; +echo "<h2> Email: '$email' </h2>"; +echo "<h2> UserID: '$uid' </h2>"; +echo "<h2> User Registration Date: '$date' </h2>"; +echo "<h2> Blocked Status: ' $blockStatus' </h2>"; +$sql = "SELECT title FROM survey WHERE survey_id IN (SELECT survey_id FROM answer_numeric WHERE user_id=$uid) ORDER BY RAND() LIMIT 3;"; +$result = mysqli_query($connect, $sql); +echo "Recent surveys that ", $user, " has taken: "; +while ($surveys_taken = mysqli_fetch_assoc($result)) { + echo $surveys_taken['title'], " "; +} +echo "<br> <br>"; - <h2> Username: <?php echo $user; ?> </h2> - <h2> Email: <?php echo $email; ?> </h2> - <h2> UserID: <?php echo $uid; ?> </h2> - <h2> User Registration Date: <?php echo $date; ?> </h2> - <h2> Blocked Status: <?php echo $blockStatus; ?> </h2> +$sql = "select title, access_code from survey where user_id=$uid order by creation_date desc limit 1;"; +$result = mysqli_query($connect, $sql); +$newest_survey = mysqli_fetch_assoc($result); + +echo $user, "'s newest survey: ", $newest_survey['title'], "<br>"; +echo "Access code: ", $newest_survey['access_code'], "<br>"; + +echo '</div>'; +?> +</html> diff --git a/website/questions.php b/website/questions.php @@ -1,13 +1,17 @@ -<p> Enter the questions for your survey </p> +<html> <?php session_start(); include 'res/navbar.php'; +echo '<link rel="stylesheet" href="res/style.css">'; +echo '<h2> Enter the questions for your survey </h2>'; + if (isset($_SESSION['questions'])) { $questions = $_SESSION['questions']; - echo "<form method = 'POST' action = 'res/submit-questions.php'>"; + $questionNum = $counter + 1; + echo "<form class='question-form' method = 'POST' action = 'res/submit-questions.php'>"; for($counter = 0; $counter < $questions; $counter++) { - echo "<input type = 'text' name = 'questions[]' class = 'questions'/><br/>"; + echo "<input type = 'text' name = 'questions[]' class = 'questions' placeholder='Question $questionNum' /><br/>"; } echo "<input type = 'submit' value = 'SEND'/>"; echo "</form>"; @@ -16,3 +20,4 @@ if (isset($_SESSION['questions'])) { exit(); } ?> +</html> diff --git a/website/res/style.css b/website/res/style.css @@ -114,6 +114,16 @@ form a{ padding: 20px; } +/* profile page */ +.profile { + position: absolute; + top: 50%; + left: 50%; + transform: translateX(-50%) translateY(-50%); + background: #9dc3ee; + padding: 20px; +} + .find-survey-form { position: absolute; top: 50%; @@ -124,3 +134,53 @@ form a{ font-family: 'Raleway', sans-serif; color: rgb(3,83,136); } + +/* create survey */ +.create-survey-form { + position: absolute; + top: 50%; + left: 50%; + transform: translateX(-50%) translateY(-50%); + background: #9dc3ee; + padding: 20px; +} + +/* create questions */ +.question-form { + position: absolute; + top: 50%; + left: 50%; + transform: translateX(-50%) translateY(-50%); + background: #9dc3ee; + padding: 20px; +} + +/* take survey */ +.take-survey { + position: absolute; + top: 50%; + left: 50%; + transform: translateX(-50%) translateY(-50%); + background: #9dc3ee; + padding: 20px; +} + +/* submit survey */ +.submit-survey { + position: absolute; + top: 50%; + left: 50%; + transform: translateX(-50%) translateY(-50%); + background: #9dc3ee; + padding: 20px; +} + +/* survey directory */ +.survey-directory { + position: absolute; + top: 50%; + left: 50%; + transform: translateX(-50%) translateY(-50%); + background: #9dc3ee; + padding: 20px; +} diff --git a/website/res/submit-survey.php b/website/res/submit-survey.php @@ -11,6 +11,9 @@ $user = $_SESSION['uid']; $survey_id = $_SESSION['sid']; $answers = $_POST['answers']; +echo '<link rel="stylesheet" href="style.css">'; +echo '<div class="submit-survey">'; + for($counter = 0; $counter < sizeof($answers); $counter++) { $questionNum = $counter+1; diff --git a/website/signup.php b/website/signup.php @@ -1,4 +1,5 @@ <html> +<link rel="stylesheet" href="res/style.css"> <form class="signup-form" action="res/register.php" method="POST"> <h2> Signup </h2> <input type="text" name="email" placeholder="Email"> diff --git a/website/takesurvey.php b/website/takesurvey.php @@ -4,11 +4,13 @@ error_reporting(E_ALL | E_STRICT); ini_set('session.cache_limiter','public'); session_cache_limiter(false); - session_start(); + include_once 'config.php'; include 'res/navbar.php'; + $uid = $_SESSION['uid']; + if (empty($_GET)) { $code = mysqli_real_escape_string($connect, $_POST['survey-code']); $sql = "SELECT * FROM survey WHERE access_code='$code'"; @@ -28,6 +30,7 @@ if (empty($code)) { $check = mysqli_num_rows($result); $block = $_SESSION['blocked']; + if ($check < 1) { header("Location: ../findsurvey.php?find=error"); exit(); @@ -35,6 +38,8 @@ $block = $_SESSION['blocked']; header("Location: res/nope.php"); exit(); }else { + echo '<link rel="stylesheet" href="res/style.css">'; + echo '<div class="take-survey">'; $row = mysqli_fetch_assoc($result); $_SESSION['sid'] = $row['survey_id']; $sid = $row['survey_id'];