From dcf61354050bfe81d6983f1aec34d7d3d6733a0d Mon Sep 17 00:00:00 2001 From: Alex Vitkov Date: Fri, 29 Jan 2021 13:43:53 +0200 Subject: index.html + login.html => index.php those files had the entire HTML tree duplicated, which would make it difficult to make any changes to the front end. this commit combines the two files in one, with some front-end JS to switch between the login and register forms. --- css/style.css | 4 ++ index.html | 65 -------------------------------- index.php | 77 +++++++++++++++++++++++++++++++++++++ js/arrows.js | 37 ------------------ js/validate_hero.js | 58 ---------------------------- login.html | 55 --------------------------- main.js | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ php/configuration.php | 18 ++++++--- php/database.php | 8 +--- php/misc.php | 5 --- php/register.php | 7 ++++ 11 files changed, 203 insertions(+), 233 deletions(-) delete mode 100644 index.html create mode 100644 index.php delete mode 100644 js/arrows.js delete mode 100644 js/validate_hero.js delete mode 100644 login.html create mode 100644 main.js diff --git a/css/style.css b/css/style.css index 31778c4..18d4817 100644 --- a/css/style.css +++ b/css/style.css @@ -195,3 +195,7 @@ input[type=submit]:hover { bottom: 0; z-index: -200; } + +#loginform { + display: none; +} diff --git a/index.html b/index.html deleted file mode 100644 index 6a2018b..0000000 --- a/index.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - shady file upload - - - - -
-
- - -
-
-
- -
- -
-

file upload service

-

that just about works

-

most of the time

-
-
- -
-
-

Get started

-
-

Username

- - - -

Email address

- - - -

Password

- - - -

Repeat Password

- - - -

Don't have an account? Log in -

-
-
- - -
-
- - -
- - - - - - diff --git a/index.php b/index.php new file mode 100644 index 0000000..3e92167 --- /dev/null +++ b/index.php @@ -0,0 +1,77 @@ + + + + + shady file upload + + +
+
+ + +
+
+
+ +
+ +
+

file upload service

+

that just about works

+

most of the time

+
+
+ +
+
+

Get started

+
+

Username

+ + + +

Email address

+ + + +

Password

+ + + +

Repeat Password

+ + + +

Already have an account? Log in +

+
+
+ +
+
+

Login

+
+

Username

+ + +

Password

+ + +

Don't have an account? Sign up +

+
+
+ + +
+
+ + +
+ + + + + diff --git a/js/arrows.js b/js/arrows.js deleted file mode 100644 index 10ad416..0000000 --- a/js/arrows.js +++ /dev/null @@ -1,37 +0,0 @@ - -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(); diff --git a/js/validate_hero.js b/js/validate_hero.js deleted file mode 100644 index 6d29a53..0000000 --- a/js/validate_hero.js +++ /dev/null @@ -1,58 +0,0 @@ - -function clear_hero_errors() -{ - var errors = document.getElementsByClassName("hero_form_error"); - var i; - for (i = 0; i < errors.length; i++) - { - errors[i].hidden = true; - } -} -function validate_hero_login_form() -{ - var username=document.forms["hero_form"]["username"].value; - var 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() -{ - var username=document.forms["hero_form"]["username"].value; - var email=document.forms["hero_form"]["email"].value; - var password=document.forms["hero_form"]["password"].value; - var password2=document.forms["hero_form"]["password2"].value; - - var 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; - -} diff --git a/login.html b/login.html deleted file mode 100644 index 525358f..0000000 --- a/login.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - - shady file upload - - - - -
-
- - -
-
-
- -
- -
-

file upload service

-

that just about works

-

most of the time

-
-
- -
-
-

Login

-
-

Username

- - -

Password

- - -

Already have an account? Sign up -

-
-
- - -
-
- - -
- - - - - - diff --git a/main.js b/main.js new file mode 100644 index 0000000..a775eb7 --- /dev/null +++ b/main.js @@ -0,0 +1,102 @@ +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() +{ + var errors = document.getElementsByClassName("hero_form_error"); + var i; + for (i = 0; i < errors.length; i++) + { + errors[i].hidden = true; + } +} +function validate_hero_login_form() +{ + var username=document.forms["hero_form"]["username"].value; + var 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() +{ + var username=document.forms["hero_form"]["username"].value; + var email=document.forms["hero_form"]["email"].value; + var password=document.forms["hero_form"]["password"].value; + var password2=document.forms["hero_form"]["password2"].value; + + var 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"; +} diff --git a/php/configuration.php b/php/configuration.php index 6b87508..89efb2a 100644 --- a/php/configuration.php +++ b/php/configuration.php @@ -3,15 +3,21 @@ $domain_name="localhost"; -$database_name="adam"; -$database_username="adam"; -$database_password="asdfd"; -$database_location="127.0.0.1"; - +if (file_exists("/home/alex")) { + $database_name="alex"; + $database_username="alex"; + $database_password="lol"; + $database_location="127.0.0.1"; +} +else { + $database_name="adam"; + $database_username="adam"; + $database_password="asdfd"; + $database_location="127.0.0.1"; +} $password_hash_algo=PASSWORD_BCRYPT; - $has_email_verification=false; ?> diff --git a/php/database.php b/php/database.php index ef2b825..f472cbf 100644 --- a/php/database.php +++ b/php/database.php @@ -16,14 +16,8 @@ require_once "misc.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*/ diff --git a/php/misc.php b/php/misc.php index 3ab0277..69cd654 100644 --- a/php/misc.php +++ b/php/misc.php @@ -1,11 +1,6 @@ Date: Fri, 29 Jan 2021 13:48:48 +0200 Subject: hero_form => login_form or register_form as they are now in the same file and conflicted --- index.php | 4 ++-- main.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/index.php b/index.php index 3e92167..90b3f56 100644 --- a/index.php +++ b/index.php @@ -25,7 +25,7 @@
-
+

Get started

Username

@@ -50,7 +50,7 @@
- +

Login

Username

diff --git a/main.js b/main.js index a775eb7..f3b6f9a 100644 --- a/main.js +++ b/main.js @@ -49,7 +49,7 @@ function clear_hero_errors() } function validate_hero_login_form() { - var username=document.forms["hero_form"]["username"].value; + var username=document.forms["login_form"]["username"].value; var flag=true; clear_hero_errors(); @@ -63,10 +63,10 @@ function validate_hero_login_form() } function validate_hero_form() { - var username=document.forms["hero_form"]["username"].value; - var email=document.forms["hero_form"]["email"].value; - var password=document.forms["hero_form"]["password"].value; - var password2=document.forms["hero_form"]["password2"].value; + var username=document.forms["register_form"]["username"].value; + var email=document.forms["register_form"]["email"].value; + var password=document.forms["register_form"]["password"].value; + var password2=document.forms["register_form"]["password2"].value; var flag=true; clear_hero_errors(); -- cgit v1.2.3 From f4d5d71da4f94bf9bc87505e745eed913c9858b9 Mon Sep 17 00:00:00 2001 From: Alex Vitkov Date: Fri, 29 Jan 2021 14:01:41 +0200 Subject: Login is now remembered in $_SESSION['username'] If it is set, user is logged in, if it is unset user is not logged in --- index.php | 68 ++++++++++++------------------------------------------ loginregister.html | 53 ++++++++++++++++++++++++++++++++++++++++++ php/login.php | 7 +++--- php/logout.php | 10 ++++++++ php/register.php | 4 ++++ 5 files changed, 86 insertions(+), 56 deletions(-) create mode 100644 loginregister.html create mode 100644 php/logout.php diff --git a/index.php b/index.php index 90b3f56..b42c5f2 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,8 @@ - shady file upload + shady file upload +
@@ -12,66 +13,27 @@
-
-
- -
-
-

file upload service

-

that just about works

-

most of the time

-
-
-
- -

Get started

-
-

Username

- - + -

Email address

- - - -

Password

- - - -

Repeat Password

- - - -

Already have an account? Log in -

- -
- -
-
-

Login

-
-

Username

- - -

Password

- - -

Don't have an account? Sign up -

-
-
+Log out +
-
- - - + diff --git a/loginregister.html b/loginregister.html new file mode 100644 index 0000000..2d87daf --- /dev/null +++ b/loginregister.html @@ -0,0 +1,53 @@ +
+
+ +
+ +
+

file upload service

+

that just about works

+

most of the time

+
+
+ +
+
+

Get started

+
+

Username

+ + + +

Email address

+ + + +

Password

+ + + +

Repeat Password

+ + + +

Already have an account? Log in +

+
+
+ +
+
+

Login

+
+

Username

+ + +

Password

+ + +

Don't have an account? Sign up +

+
+
+ + diff --git a/php/login.php b/php/login.php index e6d44dc..536a5bf 100644 --- a/php/login.php +++ b/php/login.php @@ -3,6 +3,8 @@ require_once "user.php"; require_once "database.php"; require_once "misc.php"; +session_start(); + $username=$_POST["username"]; $password=$_POST["password"]; /*server side verification*/ @@ -18,8 +20,7 @@ if(!$user) die("Password or username is incorrect"); } -echo "Username: {$user->username}\n"; -echo "Email: {$user->email_address}"; - +$_SESSION['username'] = $user->username; +header('Location: /'); ?> diff --git a/php/logout.php b/php/logout.php new file mode 100644 index 0000000..9a4cdd7 --- /dev/null +++ b/php/logout.php @@ -0,0 +1,10 @@ + diff --git a/php/register.php b/php/register.php index ef1f238..1d31a91 100644 --- a/php/register.php +++ b/php/register.php @@ -31,4 +31,8 @@ if($database->register_user($username,$password,$email)) echo "didn't register"; } + +$_SESSION['username'] = $username; +header('Location: /'); + ?> -- cgit v1.2.3 From 8ba2c35a306719932307ec5f99701101637e1fd2 Mon Sep 17 00:00:00 2001 From: Alex Vitkov Date: Fri, 29 Jan 2021 14:45:52 +0200 Subject: Menu bar, different .php pages for logged in/not logged in --- css/style.css | 28 ++++++++++++++- index.php | 35 +++++++++++------- loggedin.php | 6 ++++ loginregister.html | 53 ---------------------------- loginregister.js | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++ loginregister.php | 53 ++++++++++++++++++++++++++++ main.js | 102 ----------------------------------------------------- 7 files changed, 211 insertions(+), 168 deletions(-) create mode 100644 loggedin.php delete mode 100644 loginregister.html create mode 100644 loginregister.js create mode 100644 loginregister.php delete mode 100644 main.js 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 @@ + @@ -10,23 +13,32 @@
-
+
+
    + + +
  • +
  • Sign out
  • - + + +
  • Sign up
  • +
  • Log in
  • + + +
+ +
-Log out +
@@ -34,6 +46,5 @@
- diff --git a/loggedin.php b/loggedin.php new file mode 100644 index 0000000..884f4b9 --- /dev/null +++ b/loggedin.php @@ -0,0 +1,6 @@ +
+ ALALALLALALLAl +
+ + + diff --git a/loginregister.html b/loginregister.html deleted file mode 100644 index 2d87daf..0000000 --- a/loginregister.html +++ /dev/null @@ -1,53 +0,0 @@ -
-
- -
- -
-

file upload service

-

that just about works

-

most of the time

-
-
- -
-
-

Get started

-
-

Username

- - - -

Email address

- - - -

Password

- - - -

Repeat Password

- - - -

Already have an account? Log in -

-
-
- -
-
-

Login

-
-

Username

- - -

Password

- - -

Don't have an account? Sign up -

-
-
- - diff --git a/loginregister.js b/loginregister.js new file mode 100644 index 0000000..f3b6f9a --- /dev/null +++ b/loginregister.js @@ -0,0 +1,102 @@ +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() +{ + var errors = document.getElementsByClassName("hero_form_error"); + var i; + for (i = 0; i < errors.length; i++) + { + errors[i].hidden = true; + } +} +function validate_hero_login_form() +{ + var username=document.forms["login_form"]["username"].value; + var 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() +{ + var username=document.forms["register_form"]["username"].value; + var email=document.forms["register_form"]["email"].value; + var password=document.forms["register_form"]["password"].value; + var password2=document.forms["register_form"]["password2"].value; + + var 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"; +} diff --git a/loginregister.php b/loginregister.php new file mode 100644 index 0000000..8068b35 --- /dev/null +++ b/loginregister.php @@ -0,0 +1,53 @@ +
+
+ +
+ +
+

file upload service

+

that just about works

+

most of the time

+
+
+ +
+
+

Get started

+
+

Username

+ + + +

Email address

+ + + +

Password

+ + + +

Repeat Password

+ + + +

Already have an account? Log in +

+
+
+ +
+
+

Login

+
+

Username

+ + +

Password

+ + +

Don't have an account? Sign up +

+
+
+ + diff --git a/main.js b/main.js deleted file mode 100644 index f3b6f9a..0000000 --- a/main.js +++ /dev/null @@ -1,102 +0,0 @@ -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() -{ - var errors = document.getElementsByClassName("hero_form_error"); - var i; - for (i = 0; i < errors.length; i++) - { - errors[i].hidden = true; - } -} -function validate_hero_login_form() -{ - var username=document.forms["login_form"]["username"].value; - var 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() -{ - var username=document.forms["register_form"]["username"].value; - var email=document.forms["register_form"]["email"].value; - var password=document.forms["register_form"]["password"].value; - var password2=document.forms["register_form"]["password2"].value; - - var 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"; -} -- cgit v1.2.3 From 4417f8f23f949d549b93fe7c7227e134b6df5e9d Mon Sep 17 00:00:00 2001 From: Alex Vitkov Date: Fri, 29 Jan 2021 15:11:39 +0200 Subject: Sign out button now signs out --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 21d56f0..645e31f 100644 --- a/index.php +++ b/index.php @@ -20,7 +20,7 @@
  • -
  • Sign out
  • +
  • Sign out
  • -- cgit v1.2.3 From 74f6993d61b6b8d7b120d6b952787ccbe65788ae Mon Sep 17 00:00:00 2001 From: Alex Vitkov Date: Sat, 30 Jan 2021 10:19:29 +0200 Subject: HTML/CSS for user's filesystem --- css/style.css | 44 ++++++++++++- loggedin.php | 90 ++++++++++++++++++++++++++- mimeicons/application-octet-stream.png | Bin 0 -> 642 bytes mimeicons/application-pdf.png | Bin 0 -> 2510 bytes mimeicons/application-rss_xml.png | Bin 0 -> 2072 bytes mimeicons/application-x-bittorrent.png | Bin 0 -> 955 bytes mimeicons/application-x-cd-image.png | Bin 0 -> 3996 bytes mimeicons/application-x-executable.png | Bin 0 -> 2621 bytes mimeicons/application-x-object.png | Bin 0 -> 2913 bytes mimeicons/audio-x-generic.png | Bin 0 -> 1205 bytes mimeicons/font-x-generic.png | Bin 0 -> 2564 bytes mimeicons/image-x-generic.png | Bin 0 -> 494 bytes mimeicons/package-x-generic.png | Bin 0 -> 539 bytes mimeicons/text-html.png | Bin 0 -> 3293 bytes mimeicons/text-vnd.trolltech.linguist.png | Bin 0 -> 2815 bytes mimeicons/text-x-changelog.png | Bin 0 -> 1329 bytes mimeicons/text-x-chdr.png | Bin 0 -> 2077 bytes mimeicons/text-x-cpp.png | Bin 0 -> 2354 bytes mimeicons/text-x-csrc.png | Bin 0 -> 3152 bytes mimeicons/text-x-css.png | Bin 0 -> 1531 bytes mimeicons/text-x-generic.png | Bin 0 -> 1027 bytes mimeicons/text-x-go.png | Bin 0 -> 4613 bytes mimeicons/text-x-javascript.png | Bin 0 -> 3046 bytes mimeicons/text-x-preview.png | Bin 0 -> 521 bytes mimeicons/text-x-python.png | Bin 0 -> 3255 bytes mimeicons/text-x-script.png | Bin 0 -> 1130 bytes mimeicons/text-x-vala.png | Bin 0 -> 2669 bytes mimeicons/video-x-generic.png | Bin 0 -> 728 bytes mimeicons/x-office-calendar.png | Bin 0 -> 1487 bytes mimeicons/x-office-document-template.png | Bin 0 -> 2596 bytes mimeicons/x-office-document.png | Bin 0 -> 1207 bytes mimeicons/x-office-drawing-template.png | Bin 0 -> 3690 bytes mimeicons/x-office-drawing.png | Bin 0 -> 2994 bytes mimeicons/x-office-presentation-template.png | Bin 0 -> 2432 bytes mimeicons/x-office-presentation.png | Bin 0 -> 1446 bytes mimeicons/x-office-spreadsheet-template.png | Bin 0 -> 2009 bytes mimeicons/x-office-spreadsheet.png | Bin 0 -> 762 bytes php/configuration.php | 4 ++ php/upload.php | 1 - 39 files changed, 135 insertions(+), 4 deletions(-) create mode 100644 mimeicons/application-octet-stream.png create mode 100644 mimeicons/application-pdf.png create mode 100644 mimeicons/application-rss_xml.png create mode 100644 mimeicons/application-x-bittorrent.png create mode 100644 mimeicons/application-x-cd-image.png create mode 100644 mimeicons/application-x-executable.png create mode 100644 mimeicons/application-x-object.png create mode 100644 mimeicons/audio-x-generic.png create mode 100644 mimeicons/font-x-generic.png create mode 100644 mimeicons/image-x-generic.png create mode 100644 mimeicons/package-x-generic.png create mode 100644 mimeicons/text-html.png create mode 100644 mimeicons/text-vnd.trolltech.linguist.png create mode 100644 mimeicons/text-x-changelog.png create mode 100644 mimeicons/text-x-chdr.png create mode 100644 mimeicons/text-x-cpp.png create mode 100644 mimeicons/text-x-csrc.png create mode 100644 mimeicons/text-x-css.png create mode 100644 mimeicons/text-x-generic.png create mode 100644 mimeicons/text-x-go.png create mode 100644 mimeicons/text-x-javascript.png create mode 100644 mimeicons/text-x-preview.png create mode 100644 mimeicons/text-x-python.png create mode 100644 mimeicons/text-x-script.png create mode 100644 mimeicons/text-x-vala.png create mode 100644 mimeicons/video-x-generic.png create mode 100644 mimeicons/x-office-calendar.png create mode 100644 mimeicons/x-office-document-template.png create mode 100644 mimeicons/x-office-document.png create mode 100644 mimeicons/x-office-drawing-template.png create mode 100644 mimeicons/x-office-drawing.png create mode 100644 mimeicons/x-office-presentation-template.png create mode 100644 mimeicons/x-office-presentation.png create mode 100644 mimeicons/x-office-spreadsheet-template.png create mode 100644 mimeicons/x-office-spreadsheet.png diff --git a/css/style.css b/css/style.css index 9296e87..060fdde 100644 --- a/css/style.css +++ b/css/style.css @@ -95,7 +95,6 @@ body { font-weight: bold; } - form { background: white; margin: 4.5rem; @@ -165,7 +164,8 @@ form p { from { opacity: 0; } to { opacity: 1; } } -input { + +input:not([type=file]) { min-width: 300px; border: 1px solid #bbb; padding: 0.5rem; @@ -225,3 +225,43 @@ input[type=submit]:hover { display: none; } +.filesystem { + background: #fafafa; + margin: 1rem; + padding: 1rem; + 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: 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%); +} diff --git a/loggedin.php b/loggedin.php index 884f4b9..bafdd51 100644 --- a/loggedin.php +++ b/loggedin.php @@ -1,5 +1,93 @@
    - ALALALLALALLAl + +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    diff --git a/mimeicons/application-octet-stream.png b/mimeicons/application-octet-stream.png new file mode 100644 index 0000000..741abd2 Binary files /dev/null and b/mimeicons/application-octet-stream.png differ diff --git a/mimeicons/application-pdf.png b/mimeicons/application-pdf.png new file mode 100644 index 0000000..a5589da Binary files /dev/null and b/mimeicons/application-pdf.png differ diff --git a/mimeicons/application-rss_xml.png b/mimeicons/application-rss_xml.png new file mode 100644 index 0000000..22095de Binary files /dev/null and b/mimeicons/application-rss_xml.png differ diff --git a/mimeicons/application-x-bittorrent.png b/mimeicons/application-x-bittorrent.png new file mode 100644 index 0000000..f1d5ddd Binary files /dev/null and b/mimeicons/application-x-bittorrent.png differ diff --git a/mimeicons/application-x-cd-image.png b/mimeicons/application-x-cd-image.png new file mode 100644 index 0000000..562c663 Binary files /dev/null and b/mimeicons/application-x-cd-image.png differ diff --git a/mimeicons/application-x-executable.png b/mimeicons/application-x-executable.png new file mode 100644 index 0000000..7c65294 Binary files /dev/null and b/mimeicons/application-x-executable.png differ diff --git a/mimeicons/application-x-object.png b/mimeicons/application-x-object.png new file mode 100644 index 0000000..e8e1a9a Binary files /dev/null and b/mimeicons/application-x-object.png differ diff --git a/mimeicons/audio-x-generic.png b/mimeicons/audio-x-generic.png new file mode 100644 index 0000000..624c09c Binary files /dev/null and b/mimeicons/audio-x-generic.png differ diff --git a/mimeicons/font-x-generic.png b/mimeicons/font-x-generic.png new file mode 100644 index 0000000..ab3d469 Binary files /dev/null and b/mimeicons/font-x-generic.png differ diff --git a/mimeicons/image-x-generic.png b/mimeicons/image-x-generic.png new file mode 100644 index 0000000..17071bb Binary files /dev/null and b/mimeicons/image-x-generic.png differ diff --git a/mimeicons/package-x-generic.png b/mimeicons/package-x-generic.png new file mode 100644 index 0000000..1fca710 Binary files /dev/null and b/mimeicons/package-x-generic.png differ diff --git a/mimeicons/text-html.png b/mimeicons/text-html.png new file mode 100644 index 0000000..31ba1bd Binary files /dev/null and b/mimeicons/text-html.png differ diff --git a/mimeicons/text-vnd.trolltech.linguist.png b/mimeicons/text-vnd.trolltech.linguist.png new file mode 100644 index 0000000..3cd52b3 Binary files /dev/null and b/mimeicons/text-vnd.trolltech.linguist.png differ diff --git a/mimeicons/text-x-changelog.png b/mimeicons/text-x-changelog.png new file mode 100644 index 0000000..0d3f7bf Binary files /dev/null and b/mimeicons/text-x-changelog.png differ diff --git a/mimeicons/text-x-chdr.png b/mimeicons/text-x-chdr.png new file mode 100644 index 0000000..adfc066 Binary files /dev/null and b/mimeicons/text-x-chdr.png differ diff --git a/mimeicons/text-x-cpp.png b/mimeicons/text-x-cpp.png new file mode 100644 index 0000000..fa76ba0 Binary files /dev/null and b/mimeicons/text-x-cpp.png differ diff --git a/mimeicons/text-x-csrc.png b/mimeicons/text-x-csrc.png new file mode 100644 index 0000000..6a9f2e8 Binary files /dev/null and b/mimeicons/text-x-csrc.png differ diff --git a/mimeicons/text-x-css.png b/mimeicons/text-x-css.png new file mode 100644 index 0000000..6d3b7e7 Binary files /dev/null and b/mimeicons/text-x-css.png differ diff --git a/mimeicons/text-x-generic.png b/mimeicons/text-x-generic.png new file mode 100644 index 0000000..924a5eb Binary files /dev/null and b/mimeicons/text-x-generic.png differ diff --git a/mimeicons/text-x-go.png b/mimeicons/text-x-go.png new file mode 100644 index 0000000..3ca93a6 Binary files /dev/null and b/mimeicons/text-x-go.png differ diff --git a/mimeicons/text-x-javascript.png b/mimeicons/text-x-javascript.png new file mode 100644 index 0000000..a37deb8 Binary files /dev/null and b/mimeicons/text-x-javascript.png differ diff --git a/mimeicons/text-x-preview.png b/mimeicons/text-x-preview.png new file mode 100644 index 0000000..b86d1ca Binary files /dev/null and b/mimeicons/text-x-preview.png differ diff --git a/mimeicons/text-x-python.png b/mimeicons/text-x-python.png new file mode 100644 index 0000000..05a7a7c Binary files /dev/null and b/mimeicons/text-x-python.png differ diff --git a/mimeicons/text-x-script.png b/mimeicons/text-x-script.png new file mode 100644 index 0000000..e476856 Binary files /dev/null and b/mimeicons/text-x-script.png differ diff --git a/mimeicons/text-x-vala.png b/mimeicons/text-x-vala.png new file mode 100644 index 0000000..81595dd Binary files /dev/null and b/mimeicons/text-x-vala.png differ diff --git a/mimeicons/video-x-generic.png b/mimeicons/video-x-generic.png new file mode 100644 index 0000000..167c9d0 Binary files /dev/null and b/mimeicons/video-x-generic.png differ diff --git a/mimeicons/x-office-calendar.png b/mimeicons/x-office-calendar.png new file mode 100644 index 0000000..5da8bd3 Binary files /dev/null and b/mimeicons/x-office-calendar.png differ diff --git a/mimeicons/x-office-document-template.png b/mimeicons/x-office-document-template.png new file mode 100644 index 0000000..834ebbe Binary files /dev/null and b/mimeicons/x-office-document-template.png differ diff --git a/mimeicons/x-office-document.png b/mimeicons/x-office-document.png new file mode 100644 index 0000000..20f5939 Binary files /dev/null and b/mimeicons/x-office-document.png differ diff --git a/mimeicons/x-office-drawing-template.png b/mimeicons/x-office-drawing-template.png new file mode 100644 index 0000000..34aa16d Binary files /dev/null and b/mimeicons/x-office-drawing-template.png differ diff --git a/mimeicons/x-office-drawing.png b/mimeicons/x-office-drawing.png new file mode 100644 index 0000000..7239629 Binary files /dev/null and b/mimeicons/x-office-drawing.png differ diff --git a/mimeicons/x-office-presentation-template.png b/mimeicons/x-office-presentation-template.png new file mode 100644 index 0000000..d1e9bff Binary files /dev/null and b/mimeicons/x-office-presentation-template.png differ diff --git a/mimeicons/x-office-presentation.png b/mimeicons/x-office-presentation.png new file mode 100644 index 0000000..dfc73b4 Binary files /dev/null and b/mimeicons/x-office-presentation.png differ diff --git a/mimeicons/x-office-spreadsheet-template.png b/mimeicons/x-office-spreadsheet-template.png new file mode 100644 index 0000000..dcec754 Binary files /dev/null and b/mimeicons/x-office-spreadsheet-template.png differ diff --git a/mimeicons/x-office-spreadsheet.png b/mimeicons/x-office-spreadsheet.png new file mode 100644 index 0000000..03e7755 Binary files /dev/null and b/mimeicons/x-office-spreadsheet.png differ diff --git a/php/configuration.php b/php/configuration.php index 89efb2a..a8a7a29 100644 --- a/php/configuration.php +++ b/php/configuration.php @@ -8,12 +8,16 @@ if (file_exists("/home/alex")) { $database_username="alex"; $database_password="lol"; $database_location="127.0.0.1"; + + $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"; } diff --git a/php/upload.php b/php/upload.php index 93fa778..d9110c7 100644 --- a/php/upload.php +++ b/php/upload.php @@ -5,7 +5,6 @@ if (!array_key_exists('uf', $_FILES)) { exit(); } - $file = $_FILES['uf']; -- cgit v1.2.3 From f1cd0085cd8dba8b25818fc998d315b28e6c13a5 Mon Sep 17 00:00:00 2001 From: Alex Vitkov Date: Sat, 30 Jan 2021 11:02:15 +0200 Subject: HTML/CSS for the path field --- css/style.css | 28 +++++++++- loggedin.php | 176 ++++++++++++++++++++++++++++++---------------------------- 2 files changed, 119 insertions(+), 85 deletions(-) diff --git a/css/style.css b/css/style.css index 060fdde..aa29cf6 100644 --- a/css/style.css +++ b/css/style.css @@ -135,6 +135,7 @@ form > .content { justify-content: center; } +.filesystem > h2, form > h2 { color: #4d4d4d; margin: 0; @@ -228,11 +229,17 @@ input[type=submit]:hover { .filesystem { background: #fafafa; margin: 1rem; - padding: 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; @@ -265,3 +272,22 @@ input[type=submit]:hover { .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; +} diff --git a/loggedin.php b/loggedin.php index bafdd51..dd3a94f 100644 --- a/loggedin.php +++ b/loggedin.php @@ -1,89 +1,97 @@
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    -
    -
    - -
    asdf
    + +

    + + +

    + +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    +
    + +
    asdf
    +
    -- cgit v1.2.3