webguync Posted April 10, 2009 Share Posted April 10, 2009 I need to check to see if people have logged in before entering a page and if not, send them back to login. I know it's something like: <?php session_start(); if(($_SESSION['username'] == 1) && isset($_SESSION['password'])) { ?> how do I send them to a page login.php etc? Quote Link to comment https://forums.phpfreaks.com/topic/153410-sending-people-back-to-login-page-if-session-isnt-started/ Share on other sites More sharing options...
ratcateme Posted April 10, 2009 Share Posted April 10, 2009 well you say on your login page yo put three username in $_SESSION['username'] you check like this <?php session_start(); if(!isset($_SESSION['username'])){ header("Location: login.php"); exit; } //rest of page ?> Scott. Quote Link to comment https://forums.phpfreaks.com/topic/153410-sending-people-back-to-login-page-if-session-isnt-started/#findComment-805979 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.