Jump to content

What is this actually testing for?


weemikey

Recommended Posts

Hi all! I have this little chunk of code that I found somewhere to check for a logged in user. It checks for one of the SESSION vars that I set and if it doesn't find one it's supposed to redirect them to the login page with the error message.

 

session_start();
header("Cache-control: private");
if (!$_SESSION['email']) {
    $field_err_msg = "you aren't logged in";
    header("loginform.php?field_err_msg=".$field_err_msg);
    exit(); 
}

 

Right now if I go to this page when not logged in I get a blank screen. So I assume I'm breezing past this section and running the rest of the code. Of course I don't generate any data because none of my SESSION vars are set and the page is empty. So is the above checking to see if SESSION exist, or if it has a value? I'm confused! Thanks for any suggestions!

Link to comment
https://forums.phpfreaks.com/topic/61075-what-is-this-actually-testing-for/
Share on other sites

Archived

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

×
×
  • Create New...

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.