weemikey Posted July 21, 2007 Share Posted July 21, 2007 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 More sharing options...
keeB Posted July 21, 2007 Share Posted July 21, 2007 header("Location: my.php"); Link to comment https://forums.phpfreaks.com/topic/61075-what-is-this-actually-testing-for/#findComment-303940 Share on other sites More sharing options...
weemikey Posted July 21, 2007 Author Share Posted July 21, 2007 I am such an idiot. Thank you! Link to comment https://forums.phpfreaks.com/topic/61075-what-is-this-actually-testing-for/#findComment-303942 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.