Welcome to WebmasterWorld Guest from 18.104.22.168 , 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 msg:1314627 7:45 pm on Sep 4, 2002 (gmt 0) 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.
Nick_W msg:1314628 7:55 pm on Sep 4, 2002 (gmt 0)
maybe you could use session_is_registered() [ php.net] to check if a session var is registered and base your logic on that?
circuitjump msg:1314629 8:24 pm on Sep 4, 2002 (gmt 0)
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
Nick_W msg:1314630 8:30 pm on Sep 4, 2002 (gmt 0)
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...
circuitjump msg:1314631 9:52 pm on Sep 4, 2002 (gmt 0)
That was the problem. I really appreciate the help :)