note 26372 deleted from function.session-start by didou
| From: | didou@php.net | Date: | Sun, 18 May 2003 04:16:38 +0000 |
| Subject: | note 26372 deleted from function.session-start by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-48406@lists.php.net to get a copy of this message | ||
Note Submitter: shadowflame@starpilot.net
----
I would just like to say:
If you are using an include page, such as a config or possibly common-functions page, that relies on
session variables being pulled from the sesssion, remember to add the session_start() function
_before_ you call the includes, or your session will not be called by the page...
I've been frustrated by this so many times it's not funny.
Use:
<?php
session_start();
include 'inc/config.inc.php';
include 'inc/common.inc.php';
/*
Page code
*/
?>
Not:
<?php
include 'inc/config.inc.php';
include 'inc/common.inc.php';
session_start();
/*
Page code
*/
?>
This is important because including a file is _exactly_ like pasting it into the page, just cleaner.
If you don't call the session _first_, the config code won't recognize it and you will
waste a lot of time and be really annoyed.