simcoweb Posted September 21, 2006 Share Posted September 21, 2006 I have a registration form that, if registration is successful, starts and sets the session ID. What I want to do is have it check if the session has already been started so that they don't try to register twice in the same session. if (!$_SESSION['loggedin'] == true) { header("Location: login.php");} else{blah blah proceed with registration}I'm just not sure on my syntax but that's the jist of what I need. Link to comment https://forums.phpfreaks.com/topic/21560-how-to-check-if-session-is-already-present/ Share on other sites More sharing options...
Daniel0 Posted September 21, 2006 Share Posted September 21, 2006 That should work. Link to comment https://forums.phpfreaks.com/topic/21560-how-to-check-if-session-is-already-present/#findComment-96205 Share on other sites More sharing options...
simcoweb Posted September 21, 2006 Author Share Posted September 21, 2006 Ok, thanks. But maybe it should be an isset function?if (isset($_SESSION['loggedin'])){ header("Location: login.php");} else { run code blah blah;} Link to comment https://forums.phpfreaks.com/topic/21560-how-to-check-if-session-is-already-present/#findComment-96210 Share on other sites More sharing options...
Daniel0 Posted September 21, 2006 Share Posted September 21, 2006 Could be, but doesn't really matter. If it is true then it is set, right ;) Link to comment https://forums.phpfreaks.com/topic/21560-how-to-check-if-session-is-already-present/#findComment-96214 Share on other sites More sharing options...
simcoweb Posted September 21, 2006 Author Share Posted September 21, 2006 heh...well, it only matters if the code works ;) I'm going to use the isset function and see how things progress from there. Thanks! Link to comment https://forums.phpfreaks.com/topic/21560-how-to-check-if-session-is-already-present/#findComment-96261 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.