Session Variables and INCLUDEPHP

Discussion forum for MOD Writers regarding MOD Development.
Locked
evenicoulddoit
Registered User
Posts: 11
Joined: Tue Jan 16, 2007 5:28 pm

Session Variables and INCLUDEPHP

Post by evenicoulddoit »

Hi guys,

Another question! I'm trying to include a PHP file which uses $_SESSION validation based on the main site (ie. if they've logged in or not in this case)

I'm told I can't start a session on account of the headers already being sent, which is fine, but removing start_session() from my include results in no $_SESSION variable parameters which should be there - help!

Thanks,
Ian

ToonArmy
Former Team Member
Posts: 4608
Joined: Sat Mar 06, 2004 5:29 pm
Location: Worcestershire, UK
Name: Chris Smith
Contact:

Re: Session Variables and INCLUDEPHP

Post by ToonArmy »

Just drop session_start() in common.php or config.php (if you'd rather not modify core file files)
Chris SmithGitHub

evenicoulddoit
Registered User
Posts: 11
Joined: Tue Jan 16, 2007 5:28 pm

Re: Session Variables and INCLUDEPHP

Post by evenicoulddoit »

Hey man,

Thank you! In retrospect that was clear and obvious, so I aplogize - I guess I just felt that there was something wrong because PHPBB must be using sessions, but from what I can see it's actually only using cookies, so thanks again.

Ian

Drummer
Registered User
Posts: 199
Joined: Wed Jul 21, 2010 11:49 am

Re: Session Variables and INCLUDEPHP

Post by Drummer »

evenicoulddoit wrote:Hey man,

Thank you! In retrospect that was clear and obvious, so I aplogize - I guess I just felt that there was something wrong because PHPBB must be using sessions, but from what I can see it's actually only using cookies, so thanks again.

Ian
phpbb uses its own session system and uses cookies and URLs (querystring) to manipulate (store/propagate) the session id just like the php built-in session system does. You can hook this php built-in session system - by using session_set_save_handler() - to make it use a dbms instead of flatfiles to store the sessions data, what would be much similar to what phpbb does.

Locked

Return to “[3.0.x] MOD Writers Discussion”

cron