more session...
Posted: Thu Jun 20, 2002 4:10 am
This might be a bit easy question, but how can I check if session is already started? I tried like this:
OK, all good, but if session is not started I must stop that session and check users password and username, and then, if passwd && username are correct, I start new session and set
$_SESSION["some_value"] = something, but obviously I get error msg: cannot set cache... headers already sent... (headers went to the tube while checking....)
Any checking methodes that comes in your mind?
Thanks
-9902468
--Note!! According to php documentation ob_start doesn't work....:
Code: Select all
session_start()
if ( isset ( $_SESSIONї"some_value"] ) ) {
/* variable is set -> session is already started */
}
else {
/* variable not found -> must start new session */
unset($_SESSION);
session_destroy();
}$_SESSION["some_value"] = something, but obviously I get error msg: cannot set cache... headers already sent... (headers went to the tube while checking....)
Any checking methodes that comes in your mind?
Thanks
-9902468
--Note!! According to php documentation ob_start doesn't work....:
void ob_start ( [string output_callback])
This function will turn output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer.