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/login.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'php/login.php') 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: /'); ?> -- cgit v1.2.3