phpwiz Posted August 24, 2009 Share Posted August 24, 2009 Hi, i was wondering how i could make it so if the user is logged into my website and they try to go to the login page it says an error message like: Sorry you have to be logged out to see this page. and this is what i have so far. if () { } else { echo "Sorry, you have to be logged out to view this page. <a href='logout.php'>Logout?</a>"; } but i dont know what to put in the if statement. Quote Link to comment https://forums.phpfreaks.com/topic/171650-if-logged-in/ Share on other sites More sharing options...
mikesta707 Posted August 24, 2009 Share Posted August 24, 2009 if (isset($_SESSION['MyLoginSession']) && !empty($_SESSION['MyLoginSession'])){ # } else { echo "logout to see this page"; } ? Quote Link to comment https://forums.phpfreaks.com/topic/171650-if-logged-in/#findComment-905099 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.