howto detect if session_start is called

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tores
Forum Contributor
Posts: 120
Joined: Fri Jun 18, 2004 3:04 am

howto detect if session_start is called

Post by tores »

Hi

How do I check if session_start() is called. (So I can call session_unset() and session_destroy()).

Regards tores
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Code: Select all

print_r ($_SESSION);
or

Code: Select all

echo $_COOKIE['PHPSESSID'];
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

checking cookies to verify whether a session has started is highly unreliable. Use [php_man]session_is_registered[/php_man] or write your own session handler (details at: http://uk.php.net/manual/en/function.se ... andler.php)
Post Reply