"error", "message" => "Something went wrong! The admin has been informed" ]; }elseif ($uniqueId === false){ $notification = [ "type" => "alert", "message" => "Login details incorrect; Try again" ]; }else{ // 1 hour cookie to store userLogged username setcookie("userLogged", $uniqueId, time()+3600); // Needed as new cookies aren't checked until page reload header("Location: ./profile.php"); die(); } return $notification; } function userLogged(){ if (isset($_COOKIE['userLogged']) and $_COOKIE['userLogged']){ // User is loged in, redirect to profile echo('test userLogged'); $url = "/profile.php"; header("Location: ".$url); die(); } } # If the user account can access the page. # username/uniqueId # permissionRequired function userPermissed(){ } function logOut(){ if (isset($_COOKIE['userLogged'])) { unset($_COOKIE['userLogged']); setcookie('userLogged', null, -1, '/'); return true; } else { return false; } header("Location: /"); die(); } ?>