migi0027
-
Posts
3 -
Joined
-
Last visited
Never
Posts posted by migi0027
-
-
it returns true because the Login() function sets $_SESSION["loggedin"] to true when called.
I know that , but when i call the logout function and then call the check login, it still returns true.
-
<?php function Login() { session_start(); $_SESSION["loggedin"] = true; echo "You are logged in!"; header("Location: ../L_index.php"); //Aka Logged in Index. } function Logout() { $_SESSION["loggedin"] = false; session_destroy(); } function checklogin() { session_start(); if ($_SESSION["loggedin"] == true) { return true; } else { return false; } } ?>
This is just a tiny bit of my code, there is security holes, but as you see, there is 3 functions:
Login
Logout
Checklogin
But when i use the Login function, everything is fine, but if i then use the checklogin, then it always returns true(it returns true after i used the logout function), why?
$_SESSION Variable checking does not work...
in PHP Coding Help
Posted
Thank you so mouch, see, i knew i had done something stupid!
(Added start session)