Welcome to WebmasterWorld Guest from 220.127.116.11 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
How to check if a Session has been started with $_SESSION variable circuitjump
Hi all, How can I go about checking to see if a session has been started? session_start(); $this->resetMessages();
I want it to check if session has started, if it has not, then execute the code above. But I'm not sure on how to tell it to check with $_SESSION variable.
Thanks for the help.
maybe you could use session_is_registered() [ php.net] to check if a session var is registered and base your logic on that?
I should have posted this earlier.
The error I keep getting is
Warning: Cannot send session cache limiter - headers already sent (output started at /common/browser.detector.php:134) in /common/user.auth.php on line 13
And I'm not sure why it's doing it. From what I've been reading on php.net (http://www.php.net/manual/en/function.session-start.php),
session_start looks for an existing session, if it doesn't find one, then it creates a new session.
So I'm not sure why I keep getting this error?
Thanks once again
You can't use sessions or cookies after you have already sent content to the browser.
Do your session stuff
before you send any html or white space...
That was the problem. I really appreciate the help :)