PDA

View Full Version : session_start();


michelle
10-12-2003, 04:52 PM
I am knee-deep in the middle of installing a script (while simultaneously pulling my hair out). Here's a piece of it:


session_start();

ob_start();
require_once("settings.inc.php");
if($_REQUEST["section"]) {
$SECTION = $_REQUEST["section"];
}
if((!isset($_SESSION["prefs"][PREF_ISSETUP_ID])) || ($_SESSION["prefs"][PREF_ISSETUP_ID] == "0")) {
header("Location: ./setup/setup.php");
}


In the forum for the software (listmessenger.com) they are trying to help, and asked me a question I can't answer: "...the webserver tries to setup a session. Does your server support that?"

So... Does IH support that? ;)

tsge
10-13-2003, 05:24 AM
yes it does. That session_start() has to be the first line of the page.

Simon
10-16-2003, 04:58 PM
Well it technically doesn't have to be the first line of your script, but it does need to be before any HTML output (without output buffering).

See this note from the PHP Docs (http://au.php.net/manual/en/function.session-start.php):
Note: If you are using cookie-based sessions, you must call session_start() before anything is outputted to the browser.

Michelle, let us know if you're having trouble with a particular piece of code, including what error messages you're getting.

< Simon >

michelle
10-16-2003, 07:19 PM
Actually it's working just great now. Thank you all for your help!