commit 30ea0bae7a5718504892b6340e58587ddc43d8bc
parent a7a11144b7e5490685801642b1e8c1cbd9e0adb0
Author: jkubach <johnkubach@gmail.com>
Date: Sun, 16 Dec 2018 17:15:42 -0500
Merge branch 'master' of github.com:jkubach/survey-seahorse
Diffstat:
2 files changed, 48 insertions(+), 14 deletions(-)
diff --git a/website/index.php b/website/index.php
@@ -9,12 +9,7 @@ $q = mysqli_fetch_assoc($result);
$sql = "select * from user order by registration_date desc limit 1;";
$result = mysqli_query($connect, $sql) or die(mysqli_error($connect));
$newUser = mysqli_fetch_assoc($result);
-if (isset($_SESSION['username'])) {
-$user = $_SESSION['username'];
- $profile = $user . "'s Profile";
-} else {
- $profile = "Profile";
-}
+
?>
<head>
<title>Survey Seahorse</title>
@@ -28,14 +23,7 @@ $user = $_SESSION['username'];
<meta name="theme-color" content="#ffffff">
</head>
-<link rel = "stylesheet" href= "res/nav.css" />
-<div class= nav>
- <a href="index.php" target="_blank"> Home </a>
- <a href="profile.php" target="_blank"> <?php echo $profile; ?> </a>
- <a href="directory.php" target="_blank"> Surveys </a>
- <a href="createsurvey.php" target="_blank"> Create a Survey </a>
-</div>
-<br><br>
+<?php include 'res/navbar.php';?>
<h1> Survey Seahorse </h1>
<h3> Random Question: <?php echo $q['question_content']; ?> </h3>
diff --git a/website/res/navbar.php b/website/res/navbar.php
@@ -0,0 +1,46 @@
+<?php
+if (isset($_SESSION['username'])) {
+ $user = $_SESSION['username'];
+ $profile = $user . "'s Profile";
+ } else {
+ $profile = "Profile";
+}
+?>
+
+<style>
+.navbox{
+ margin: 0;
+ padding: 10px;
+ background-color: lightblue;
+}
+
+.nav {
+ display: inline;
+ overflow: hidden;
+ font-family: Arial;
+}
+
+.nav a {
+ float: left;
+ font-size: 16px;
+ color: #000;
+ background-color: lightblue;
+ text-align: center;
+ padding: 10px 16px;
+ text-decoration: none;
+}
+
+.nav a:hover, .drop:hover .dropbtn {
+ background-color: blue;
+}
+</style>
+<div class=navbox>
+ <div class= nav>
+ <a href="index.php" target="_blank"> Home </a>
+ <a href="directory.php" target="_blank"> Surveys </a>
+ <a href="createsurvey.php" target="_blank"> Create a Survey </a>
+ <a href="profile.php" target="_blank"> <?php echo $user; ?>'s Profile </a>
+ <b href="profile.php" target="_blank"> Find a survey </b>
+ </div>
+ <br><br>
+</div>