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. --- php/register.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'php/register.php') diff --git a/php/register.php b/php/register.php index b6b164c..ef1f238 100644 --- a/php/register.php +++ b/php/register.php @@ -8,6 +8,13 @@ $password=$_POST["password"]; $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)) { -- 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 --- php/register.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'php/register.php') 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