aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Vitkov <alexvitkov98@gmail.com>2021-01-29 14:45:52 +0200
committerAlex Vitkov <alexvitkov98@gmail.com>2021-01-29 14:45:52 +0200
commit8ba2c35a306719932307ec5f99701101637e1fd2 (patch)
tree0492e0d614c8afe741c8160481526c73175d99cb
parentf4d5d71da4f94bf9bc87505e745eed913c9858b9 (diff)
downloadfileup-8ba2c35a306719932307ec5f99701101637e1fd2.tar.gz
Menu bar, different .php pages for logged in/not logged in
-rw-r--r--css/style.css28
-rw-r--r--index.php35
-rw-r--r--loggedin.php6
-rw-r--r--loginregister.js (renamed from main.js)0
-rw-r--r--loginregister.php (renamed from loginregister.html)2
5 files changed, 57 insertions, 14 deletions
diff --git a/css/style.css b/css/style.css
index 18d4817..9296e87 100644
--- a/css/style.css
+++ b/css/style.css
@@ -23,13 +23,38 @@ body {
#header {
background: white;
margin: 0;
- padding: 1rem;
+ padding: 0;
+ height: 3rem;
font-size: 2em;
+ display: flex;
+ align-items: stretch;
+ user-select: none;
+ -webkit-user-select: none;
+ -ms-user-select: none;
+}
+
+#topmenu {
+ font-size: 1.3rem;
+ list-style-type: none;
+ display: flex;
+ margin: 0;
+ padding: 0;
+}
+
+#topmenu > li {
+ cursor: pointer;
+ padding: 10px;
+}
+
+#topmenu > li:hover {
+ background: #eee;
}
.logo {
font-family: monospace;
margin: 0;
+ align-self: center;
+ padding-left: 2rem;
}
#hero {
@@ -199,3 +224,4 @@ input[type=submit]:hover {
#loginform {
display: none;
}
+
diff --git a/index.php b/index.php
index b42c5f2..21d56f0 100644
--- a/index.php
+++ b/index.php
@@ -1,3 +1,6 @@
+<?php
+ session_start();
+?>
<!DOCTYPE html>
<html>
<head>
@@ -10,23 +13,32 @@
<div class="vert2">
<div id="header">
<p class="logo">shady_file_upload</p>
- </div>
- <div id="page">
+ <div style="flex: 1 0 0;"></div>
+ <ul id="topmenu">
+ <?php if (array_key_exists("username", $_SESSION)) { ?>
+
+ <li><?php echo $_SESSION['username'];?></li>
+ <li>Sign out</li>
-<?php
- session_start();
- if (array_key_exists("username", $_SESSION)) {
- echo "Welcome, $_SESSION[username]";
-?>
+ <?php } else {?>
+
+ <li onclick="showLogin(false)">Sign up</li>
+ <li onclick="showLogin(true)">Log in</li>
+
+ <?php }?>
+ </ul>
+
+ </div>
-<a href="/php/logout.php">Log out</a>
+ <div id="page">
<?php
- }
- else {
- require_once("loginregister.html");
+ if (array_key_exists("username", $_SESSION)) {
+ require_once("loggedin.php");
+ } else {
+ require_once("loginregister.php");
}
?>
@@ -34,6 +46,5 @@
</div>
<img src="svg/bottom.svg" class="bgbottom">
</div>
- <script src="main.js"></script>
</body>
<html>
diff --git a/loggedin.php b/loggedin.php
new file mode 100644
index 0000000..884f4b9
--- /dev/null
+++ b/loggedin.php
@@ -0,0 +1,6 @@
+<div>
+ ALALALLALALLAl
+</div>
+
+
+
diff --git a/main.js b/loginregister.js
index f3b6f9a..f3b6f9a 100644
--- a/main.js
+++ b/loginregister.js
diff --git a/loginregister.html b/loginregister.php
index 2d87daf..8068b35 100644
--- a/loginregister.html
+++ b/loginregister.php
@@ -50,4 +50,4 @@
</form>
</div>
-
+<script src="loginregister.js"></script>