Jump to content

Archived

This topic is now archived and is closed to further replies.

simcoweb

How to check if session is already present?

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Ok, thanks. But maybe it should be an isset function?

if (isset($_SESSION['loggedin']))
{
  header("Location: login.php");
} else {
  run code blah blah;
}

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.