F diff --git a/css/style.css b/css/style.css
--- a/css/style.css
+++ b/css/style.css
#header {
background: white;
margin: 0;
- padding: 0;
- height: 3rem;
+ padding: 1rem;
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 {
font-weight: bold;
}
+
form {
background: white;
margin: 4.5rem;
justify-content: center;
}
- .filesystem > h2,
form > h2 {
color: #4d4d4d;
margin: 0;
from { opacity: 0; }
to { opacity: 1; }
}
-
- input:not([type=file]) {
+ input {
min-width: 300px;
border: 1px solid #bbb;
padding: 0.5rem;
bottom: 0;
z-index: -200;
}
-
- #loginform {
- display: none;
- }
-
- .filesystem {
- background: #fafafa;
- margin: 1rem;
- padding: 0;
- box-shadow: 0 0.8rem 1.3rem rgba(0,0,0,0.2);
- border-radius: 0.5rem;
- border-radius: 0.5rem;
- border: 1px solid #b9b9b9;
-
- display: block;
- }
-
- .files {
- padding: 1rem;
- display: grid;
-
- grid-gap: 20px;
- grid-auto-rows: 10rem;
- grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
- }
-
- .file {
- padding: 0.5rem;
- cursor: pointer;
- color: #333;
- user-select: none;
- -webkit-user-select: none;
- -ms-user-select: none;
-
- display: flex;
- flex-direction: column;
- align-items: center;
- border: 1px solid #fafafa;
- border-radius: 0.3rem;
- }
-
- .file:hover {
- padding: 0.5rem;
- background: white;
- color: black;
- border-color: #ddd;
- }
-
- .file:hover > img {
- filter: brightness(150%);
- }
-
- .path {
- font-size: 1.5rem;
- }
-
- .path > a {
- color: #333;
- text-decoration: none;
- }
-
- .path > a:hover {
- text-decoration: underline;
- }
-
- .filesystem > h2 {
- display: flex;
- align-items: baseline;
- font-weight: normal;
- }
F diff --git a/index.html b/index.html
new file mode 100644
--- /dev/null
+++ b/index.html
+ <!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="utf-8">
+ <title>shady file upload</title>
+ <link rel="stylesheet" type="text/css" href="css/style.css">
+ </head>
+
+ <body>
+ <div class="overlay" style="height: 100%;">
+ <div class="vert2">
+ <div id="header">
+ <p class="logo">shady_file_upload</p>
+ </div>
+
+ <div id="page">
+ <div id="hero" class="overlay">
+ <div id="arrows">
+ <img src="svg/arrow.svg" id="protoarrow" style="display: none">
+ </div>
+
+ <div class="vcenter">
+ <p>file upload service</p>
+ <p class="big">that <span class="blue">just about works</span></p>
+ <p>most of the time</p>
+ </div>
+ </div>
+
+ <div class="vcenter">
+ <form name="hero_form" action="/php/register.php" method="post" onsubmit="return validate_hero_form()">
+ <h2>Get started</h2>
+ <div class="content">
+ <p>Username</p>
+ <input type="text" id="username" name="username">
+ <p id="username-length-error" class="hero_form_error" hidden>Please specify a username</p>
+
+ <p>Email address</p>
+ <input type="text" id="email" name="email">
+ <p id="email-error" class="hero_form_error" hidden>Invalid email address</p>
+
+ <p>Password</p>
+ <input type="password" id="password" name="password">
+ <p id="password-length-error" class="hero_form_error" hidden>Please provide a password</p>
+
+ <p>Repeat Password</p>
+ <input type="password" id="password2" name="password2">
+ <p id="password-match-error" class="hero_form_error" hidden>Passwords didn't match</p>
+ <input type="submit" value="Sign up">
+ <p style="font-size: 1.1em;">Don't have an account? <a href="login.html">Log in</a>
+ </div>
+ </form>
+ </div>
+
+
+ </div>
+ </div>
+
+ <img src="svg/bottom.svg" class="bgbottom">
+ </div>
+
+ <script src="js/arrows.js"></script>
+ <script src="js/validate_hero.js"></script>
+
+ </body>
+ <html>
F diff --git a/index.php b/index.php
deleted file mode 100644
--- a/index.php
+++ /dev/null
- <?php
- session_start();
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>shady file upload</title> <link rel="stylesheet" type="text/css" href="css/style.css">
- </head>
-
- <body>
- <div class="overlay" style="height: 100%;">
- <div class="vert2">
- <div id="header">
- <p class="logo">shady_file_upload</p>
-
- <div style="flex: 1 0 0;"></div>
- <ul id="topmenu">
-
- <?php if (array_key_exists("username", $_SESSION)) { ?>
-
- <li><?php echo $_SESSION['username'];?></li>
- <li onclick="window.location.href='/php/logout.php'">Sign out</li>
-
- <?php } else {?>
-
- <li onclick="showLogin(false)">Sign up</li>
- <li onclick="showLogin(true)">Log in</li>
-
- <?php }?>
- </ul>
-
- </div>
-
- <div id="page">
-
- <?php
- if (array_key_exists("username", $_SESSION)) {
- require_once("loggedin.php");
- } else {
- require_once("loginregister.php");
- }
- ?>
-
- </div>
- </div>
- <img src="svg/bottom.svg" class="bgbottom">
- </div>
- </body>
- <html>
F diff --git a/js/arrows.js b/js/arrows.js
new file mode 100644
--- /dev/null
+++ b/js/arrows.js
+
+ arrows = [];
+
+ const minSpeed = 3;
+ const maxSpeed = 8;
+ const delay = 1500;
+ const lifetime = 20000;
+
+ function make_arrow() {
+ const svg = document.getElementById("protoarrow").cloneNode();
+ svg.style.left = Math.random() * 100 + '%';
+ svg.style.display = 'block';
+ document.getElementById('arrows').append(svg);
+ const ob = {
+ y: -800,
+ svg: svg,
+ speed: Math.random() * (maxSpeed - minSpeed) + minSpeed
+ };
+ arrows.push(ob);
+ setTimeout(make_arrow, delay);
+ setTimeout(() => {
+ svg.remove();
+ arrows.shift();
+ }, lifetime);
+ }
+
+ function update() {
+ for (const arrow of arrows) {
+ arrow.y += arrow.speed;
+ arrow.svg.style.bottom = arrow.y + 'px';
+ }
+
+ window.requestAnimationFrame(update);
+ }
+
+ make_arrow();
+ update();
F diff --git a/js/validate_hero.js b/js/validate_hero.js
new file mode 100644
--- /dev/null
+++ b/js/validate_hero.js
+
+ function clear_hero_errors()
+ {
+ let errors = document.getElementsByClassName("hero_form_error");
+ let i;
+ for (i = 0; i < errors.length; i++)
+ {
+ errors[i].hidden = true;
+ }
+ }
+ function validate_hero_login_form()
+ {
+ let username=document.forms["hero_form"]["username"].value;
+ let flag=true;
+ clear_hero_errors();
+
+ if(username.length==0)
+ {
+ document.getElementById("username-length-error").hidden=false;
+ flag=false;
+ }
+ document.activeElement.blur();
+ return flag;
+ }
+ function validate_hero_form()
+ {
+ let username=document.forms["hero_form"]["username"].value;
+ let email=document.forms["hero_form"]["email"].value;
+ let password=document.forms["hero_form"]["password"].value;
+ let password2=document.forms["hero_form"]["password2"].value;
+
+ let flag=true;
+ clear_hero_errors();
+
+ if(username.length==0)
+ {
+ document.getElementById("username-length-error").hidden=false;
+ flag=false;
+ }
+ if(!email.match(/\S+@\S+/))
+ {
+ document.getElementById("email-error").hidden=false;
+ flag=false;
+ }
+ if(password.length==0)
+ {
+ document.getElementById("password-length-error").hidden=false;
+ flag=false;
+ }
+ if(password !== password2)
+ {
+ document.getElementById("password-match-error").hidden=false;
+ flag=false;
+ }
+ document.activeElement.blur();
+ return flag;
+
+ }
F diff --git a/loggedin.php b/loggedin.php
deleted file mode 100644
--- a/loggedin.php
+++ /dev/null
- <div>
- <div class="filesystem">
-
- <h2>
- <div class="path">
- <a class="pathentry" href="#"> <?php echo $_SESSION['username'] ?>'s files/</a><a class="pathentry" href="#">foo/</a><a class="pathentry" href="#">bar</a></div>
- <input type="button" value="New Folder">
- </h2>
-
- <div class="files">
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- <div class="file">
- <img src="/mimeicons/application-pdf.png">
- <div class="filename">asdf</div>
- </div>
- </div>
- </div>
-
-
- </div>
-
-
-
F diff --git a/login.html b/login.html
new file mode 100644
--- /dev/null
+++ b/login.html
+ <!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="utf-8">
+ <title>shady file upload</title>
+ <link rel="stylesheet" type="text/css" href="css/style.css">
+ </head>
+
+ <body>
+ <div class="overlay" style="height: 100%;">
+ <div class="vert2">
+ <div id="header">
+ <p class="logo">shady_file_upload</p>
+ </div>
+
+ <div id="page">
+ <div id="hero" class="overlay">
+ <div id="arrows">
+ <img src="svg/arrow.svg" id="protoarrow" style="display: none">
+ </div>
+
+ <div class="vcenter">
+ <p>file upload service</p>
+ <p class="big">that <span class="blue">just about works</span></p>
+ <p>most of the time</p>
+ </div>
+ </div>
+
+ <div class="vcenter">
+ <form name="hero_form" action="/php/login.php" method="post" onsubmit="return validate_hero_login_form()">
+ <h2>Login</h2>
+ <div class="content">
+ <p>Username</p>
+ <input type="text" id="username" name="username">
+ <p id="username-length-error" class="hero_form_error" hidden>Please enter a username</p>
+ <p>Password</p>
+ <input type="password" id="password" name="password">
+ <input type="submit" value="Login">
+ <p style="font-size: 1.1em;">Already have an account? <a href="index.html">Sign up</a>
+ </div>
+ </form>
+ </div>
+
+
+ </div>
+ </div>
+
+ <img src="svg/bottom.svg" class="bgbottom">
+ </div>
+
+ <script src="js/arrows.js"></script>
+ <script src="js/validate_hero.js"></script>
+
+ </body>
+ <html>
F diff --git a/loginregister.js b/loginregister.js
deleted file mode 100644
--- a/loginregister.js
+++ /dev/null
- arrows = [];
-
- const minSpeed = 3;
- const maxSpeed = 8;
- const delay = 1500;
- const lifetime = 20000;
-
- function make_arrow() {
- const svg = document.getElementById("protoarrow").cloneNode();
- svg.style.left = Math.random() * 100 + '%';
- svg.style.display = 'block';
- document.getElementById('arrows').append(svg);
- const ob = {
- y: -800,
- svg: svg,
- speed: Math.random() * (maxSpeed - minSpeed) + minSpeed
- };
- arrows.push(ob);
- setTimeout(make_arrow, delay);
- setTimeout(() => {
- svg.remove();
- arrows.shift();
- }, lifetime);
- }
-
- function update() {
- for (const arrow of arrows) {
- arrow.y += arrow.speed;
- arrow.svg.style.bottom = arrow.y + 'px';
- }
-
- window.requestAnimationFrame(update);
- }
-
- make_arrow();
- update();
-
-
-
-
- function clear_hero_errors()
- {
- let errors = document.getElementsByClassName("hero_form_error");
- for (let i = 0; i < errors.length; i++)
- {
- errors[i].hidden = true;
- }
- }
- function validate_hero_login_form()
- {
- let username=document.forms["login_form"]["username"].value;
- let flag=true;
- clear_hero_errors();
-
- if(username.length==0)
- {
- document.getElementById("username-length-error").hidden=false;
- flag=false;
- }
- document.activeElement.blur();
- return flag;
- }
- function validate_hero_form()
- {
- let username=document.forms["register_form"]["username"].value;
- let email=document.forms["register_form"]["email"].value;
- let password=document.forms["register_form"]["password"].value;
- let password2=document.forms["register_form"]["password2"].value;
-
- let flag=true;
- clear_hero_errors();
-
- if(username.length==0)
- {
- document.getElementById("username-length-error").hidden=false;
- flag=false;
- }
- if(!email.match(/\S+@\S+/))
- {
- document.getElementById("email-error").hidden=false;
- flag=false;
- }
- if(password.length==0)
- {
- document.getElementById("password-length-error").hidden=false;
- flag=false;
- }
- if(password !== password2)
- {
- document.getElementById("password-match-error").hidden=false;
- flag=false;
- }
- document.activeElement.blur();
- return flag;
-
- }
-
- function showLogin(l) {
- document.getElementById("loginform").style.display = l ? "flex" : "none";
- document.getElementById("signupform").style.display = l ? "none" : "flex";
- }
F diff --git a/loginregister.php b/loginregister.php
deleted file mode 100644
--- a/loginregister.php
+++ /dev/null
- <div id="hero" class="overlay">
- <div id="arrows">
- <img src="svg/arrow.svg" id="protoarrow" style="display: none">
- </div>
-
- <div class="vcenter">
- <p>file upload service</p>
- <p class="big">that <span class="blue">just about works</span></p>
- <p>most of the time</p>
- </div>
- </div>
-
- <div class="vcenter" id="signupform">
- <form name="register_form" action="/php/register.php" method="post" onsubmit="return validate_hero_form()">
- <h2>Get started</h2>
- <div class="content">
- <p>Username</p>
- <input type="text" id="username" name="username">
- <p id="username-length-error" class="hero_form_error" hidden>Please specify a username</p>
-
- <p>Email address</p>
- <input type="text" id="email" name="email">
- <p id="email-error" class="hero_form_error" hidden>Invalid email address</p>
-
- <p>Password</p>
- <input type="password" id="password" name="password">
- <p id="password-length-error" class="hero_form_error" hidden>Please provide a password</p>
-
- <p>Repeat Password</p>
- <input type="password" id="password2" name="password2">
- <p id="password-match-error" class="hero_form_error" hidden>Passwords didn't match</p>
- <input type="submit" value="Sign up">
- <p style="font-size: 1.1em;">Already have an account? <a href="#" onclick="showLogin(true)">Log in</a>
- </div>
- </form>
- </div>
-
- <div class="vcenter" id="loginform">
- <form name="login_form" action="/php/login.php" method="post" onsubmit="return validate_hero_login_form()">
- <h2>Login</h2>
- <div class="content">
- <p>Username</p>
- <input type="text" id="username" name="username">
- <p id="username-length-error" class="hero_form_error" hidden>Please enter a username</p>
- <p>Password</p>
- <input type="password" id="password" name="password">
- <input type="submit" value="Login">
- <p style="font-size: 1.1em;">Don't have an account? <a href="#" onclick="showLogin(false)">Sign up</a>
- </div>
- </form>
- </div>
-
- <script src="loginregister.js"></script>
F diff --git a/mimeicons/application-octet-stream.png b/mimeicons/application-octet-stream.png
deleted file mode 100644
B Binary files a/mimeicons/application-octet-stream.png and /dev/null differ
F diff --git a/mimeicons/application-pdf.png b/mimeicons/application-pdf.png
deleted file mode 100644
B Binary files a/mimeicons/application-pdf.png and /dev/null differ
F diff --git a/mimeicons/application-rss_xml.png b/mimeicons/application-rss_xml.png
deleted file mode 100644
B Binary files a/mimeicons/application-rss_xml.png and /dev/null differ
F diff --git a/mimeicons/application-x-bittorrent.png b/mimeicons/application-x-bittorrent.png
deleted file mode 100644
B Binary files a/mimeicons/application-x-bittorrent.png and /dev/null differ
F diff --git a/mimeicons/application-x-cd-image.png b/mimeicons/application-x-cd-image.png
deleted file mode 100644
B Binary files a/mimeicons/application-x-cd-image.png and /dev/null differ
F diff --git a/mimeicons/application-x-executable.png b/mimeicons/application-x-executable.png
deleted file mode 100644
B Binary files a/mimeicons/application-x-executable.png and /dev/null differ
F diff --git a/mimeicons/application-x-object.png b/mimeicons/application-x-object.png
deleted file mode 100644
B Binary files a/mimeicons/application-x-object.png and /dev/null differ
F diff --git a/mimeicons/audio-x-generic.png b/mimeicons/audio-x-generic.png
deleted file mode 100644
B Binary files a/mimeicons/audio-x-generic.png and /dev/null differ
F diff --git a/mimeicons/font-x-generic.png b/mimeicons/font-x-generic.png
deleted file mode 100644
B Binary files a/mimeicons/font-x-generic.png and /dev/null differ
F diff --git a/mimeicons/image-x-generic.png b/mimeicons/image-x-generic.png
deleted file mode 100644
B Binary files a/mimeicons/image-x-generic.png and /dev/null differ
F diff --git a/mimeicons/package-x-generic.png b/mimeicons/package-x-generic.png
deleted file mode 100644
B Binary files a/mimeicons/package-x-generic.png and /dev/null differ
F diff --git a/mimeicons/text-html.png b/mimeicons/text-html.png
deleted file mode 100644
B Binary files a/mimeicons/text-html.png and /dev/null differ
F diff --git a/mimeicons/text-vnd.trolltech.linguist.png b/mimeicons/text-vnd.trolltech.linguist.png
deleted file mode 100644
B Binary files a/mimeicons/text-vnd.trolltech.linguist.png and /dev/null differ
F diff --git a/mimeicons/text-x-changelog.png b/mimeicons/text-x-changelog.png
deleted file mode 100644
B Binary files a/mimeicons/text-x-changelog.png and /dev/null differ
F diff --git a/mimeicons/text-x-chdr.png b/mimeicons/text-x-chdr.png
deleted file mode 100644
B Binary files a/mimeicons/text-x-chdr.png and /dev/null differ
F diff --git a/mimeicons/text-x-cpp.png b/mimeicons/text-x-cpp.png
deleted file mode 100644
B Binary files a/mimeicons/text-x-cpp.png and /dev/null differ
F diff --git a/mimeicons/text-x-csrc.png b/mimeicons/text-x-csrc.png
deleted file mode 100644
B Binary files a/mimeicons/text-x-csrc.png and /dev/null differ
F diff --git a/mimeicons/text-x-css.png b/mimeicons/text-x-css.png
deleted file mode 100644
B Binary files a/mimeicons/text-x-css.png and /dev/null differ
F diff --git a/mimeicons/text-x-generic.png b/mimeicons/text-x-generic.png
deleted file mode 100644
B Binary files a/mimeicons/text-x-generic.png and /dev/null differ
F diff --git a/mimeicons/text-x-go.png b/mimeicons/text-x-go.png
deleted file mode 100644
B Binary files a/mimeicons/text-x-go.png and /dev/null differ
F diff --git a/mimeicons/text-x-javascript.png b/mimeicons/text-x-javascript.png
deleted file mode 100644
B Binary files a/mimeicons/text-x-javascript.png and /dev/null differ
F diff --git a/mimeicons/text-x-preview.png b/mimeicons/text-x-preview.png
deleted file mode 100644
B Binary files a/mimeicons/text-x-preview.png and /dev/null differ
F diff --git a/mimeicons/text-x-python.png b/mimeicons/text-x-python.png
deleted file mode 100644
B Binary files a/mimeicons/text-x-python.png and /dev/null differ
F diff --git a/mimeicons/text-x-script.png b/mimeicons/text-x-script.png
deleted file mode 100644
B Binary files a/mimeicons/text-x-script.png and /dev/null differ
F diff --git a/mimeicons/text-x-vala.png b/mimeicons/text-x-vala.png
deleted file mode 100644
B Binary files a/mimeicons/text-x-vala.png and /dev/null differ
F diff --git a/mimeicons/video-x-generic.png b/mimeicons/video-x-generic.png
deleted file mode 100644
B Binary files a/mimeicons/video-x-generic.png and /dev/null differ
F diff --git a/mimeicons/x-office-calendar.png b/mimeicons/x-office-calendar.png
deleted file mode 100644
B Binary files a/mimeicons/x-office-calendar.png and /dev/null differ
F diff --git a/mimeicons/x-office-document-template.png b/mimeicons/x-office-document-template.png
deleted file mode 100644
B Binary files a/mimeicons/x-office-document-template.png and /dev/null differ
F diff --git a/mimeicons/x-office-document.png b/mimeicons/x-office-document.png
deleted file mode 100644
B Binary files a/mimeicons/x-office-document.png and /dev/null differ
F diff --git a/mimeicons/x-office-drawing-template.png b/mimeicons/x-office-drawing-template.png
deleted file mode 100644
B Binary files a/mimeicons/x-office-drawing-template.png and /dev/null differ
F diff --git a/mimeicons/x-office-drawing.png b/mimeicons/x-office-drawing.png
deleted file mode 100644
B Binary files a/mimeicons/x-office-drawing.png and /dev/null differ
F diff --git a/mimeicons/x-office-presentation-template.png b/mimeicons/x-office-presentation-template.png
deleted file mode 100644
B Binary files a/mimeicons/x-office-presentation-template.png and /dev/null differ
F diff --git a/mimeicons/x-office-presentation.png b/mimeicons/x-office-presentation.png
deleted file mode 100644
B Binary files a/mimeicons/x-office-presentation.png and /dev/null differ
F diff --git a/mimeicons/x-office-spreadsheet-template.png b/mimeicons/x-office-spreadsheet-template.png
deleted file mode 100644
B Binary files a/mimeicons/x-office-spreadsheet-template.png and /dev/null differ
F diff --git a/mimeicons/x-office-spreadsheet.png b/mimeicons/x-office-spreadsheet.png
deleted file mode 100644
B Binary files a/mimeicons/x-office-spreadsheet.png and /dev/null differ
F diff --git a/php/configuration.php b/php/configuration.php
--- a/php/configuration.php
+++ b/php/configuration.php
$domain_name="localhost";
- if (file_exists("/home/alex")) {
- $database_name="alex";
- $database_username="alex";
- $database_password="lol";
- $database_location="127.0.0.1";
+ $database_name="fileup_testing";
+ $database_username="outsider";
+ $database_password="parola123";
+ $database_location="localhost";
- $storage_root = "/home/alex/fileup_storage";
- }
- else {
- $database_name="adam";
- $database_username="adam";
- $database_password="asdfd";
- $database_location="127.0.0.1";
-
- $storage_root = "/home/adam/fileup_storage";
- }
$password_hash_algo=PASSWORD_BCRYPT;
+
$has_email_verification=false;
?>
F diff --git a/php/database.php b/php/database.php
--- a/php/database.php
+++ b/php/database.php
global $database_username;
global $database_password;
global $database_location;
-
+ try
+ {
$this->pdo=new PDO("mysql:dbname={$database_name};host={$database_location}",$database_username,$database_password);
+ }catch(PDOException $e)
+ {
+ error_log("Could not get database {$database_name} from {$database_location}, {$e} ");
+ die("The cow bought the farm");
+ }
}
/*returns false if this isn't a user, otherwise returns the user*/
F diff --git a/php/login.php b/php/login.php
--- a/php/login.php
+++ b/php/login.php
require_once "database.php";
require_once "misc.php";
- session_start();
-
$username=$_POST["username"];
$password=$_POST["password"];
/*server side verification*/
die("Password or username is incorrect");
}
- $_SESSION['username'] = $user->username;
- header('Location: /');
+ echo "Username: {$user->username}\n";
+ echo "Email: {$user->email_address}";
+
?>
F diff --git a/php/logout.php b/php/logout.php
deleted file mode 100644
--- a/php/logout.php
+++ /dev/null
- <?php
- // TODO
- // This is dangerous and stupid
- // Right now every webpage can redirect any of its users to http://shady.upload/logout
- // which will log the user out of our webpage
-
- session_start();
- unset($_SESSION['username']);
- header('Location: /');
- ?>
F diff --git a/php/misc.php b/php/misc.php
--- a/php/misc.php
+++ b/php/misc.php
<?php
require_once "user.php";
+ function validate_credentials(string $username,string $email,string $password,string $password2) : bool
+ {
+ return true;
+ }
+
function generate_email_verification_link()
{
/*TODO*/
F diff --git a/php/register.php b/php/register.php
--- a/php/register.php
+++ b/php/register.php
$password2=$_POST["password2"];
$email=$_POST["email"];
-
- function validate_credentials(string $username,string $email,string $password,string $password2) : bool
- {
- return true;
- }
-
-
/*check if we are given shady credentials*/
if(!validate_credentials($username,$email,$password,$password2))
{
echo "didn't register";
}
-
- $_SESSION['username'] = $username;
- header('Location: /');
-
?>
F diff --git a/php/upload.php b/php/upload.php
--- a/php/upload.php
+++ b/php/upload.php
exit();
}
+
$file = $_FILES['uf'];
F diff --git a/sql/fileshare.sql b/sql/fileshare.sql
--- a/sql/fileshare.sql
+++ b/sql/fileshare.sql
create table access (
file_id int not null,
user_id int not null,
+
can_view boolean not null default true,
can_remove boolean not null default false,
check (can_view=true or can_remove=true) ,