[PHP] Re: Checking if session has been started
Why not populate a session variable, in the page that starts the session, like : session_start(); session_register(valid_session); $valid_session = true; Then in the page that you need to check, like: if ($session_valid) { // Do something since a session is already running } -- Gaylen [EMAIL PROTECTED] http://www.gaylenandmargie.com PHP KISGB v1.2 Guestbook http://www.gaylenandmargie.com/publicscripts Alexander Skwar [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi I need to run some code if a session has been started. However, to do this, I need to figure out IF the session has been started at all. How can I do this? Is checking for the count of elements in HTTP_SESSION_VARS the only reliable way of doing this? Like so? ?php if (0 count($HTTP_SESSION_VARS)){ // Do something since a session is already running } ? Thanks, Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.digitalprojects.com | http://www.iso-top.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 3 days 3 hours 9 minutes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Checking if session has been started
session_start(); $valid_session = true; session_register(valid_session); OR SOMETHING LIKE THIS? if (session_is_registered($valid_session)) { // Do something?! } Gaylen Fraley [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Why not populate a session variable, in the page that starts the session, like : session_start(); session_register(valid_session); $valid_session = true; Then in the page that you need to check, like: if ($session_valid) { // Do something since a session is already running } -- Gaylen [EMAIL PROTECTED] http://www.gaylenandmargie.com PHP KISGB v1.2 Guestbook http://www.gaylenandmargie.com/publicscripts Alexander Skwar [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi I need to run some code if a session has been started. However, to do this, I need to figure out IF the session has been started at all. How can I do this? Is checking for the count of elements in HTTP_SESSION_VARS the only reliable way of doing this? Like so? ?php if (0 count($HTTP_SESSION_VARS)){ // Do something since a session is already running } ? Thanks, Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.digitalprojects.com | http://www.iso-top.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 3 days 3 hours 9 minutes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Checking if session has been started
So sprach »Fredrik Arild Takle« am 2001-09-22 um 18:00:37 +0200 : session_register(valid_session); OR SOMETHING LIKE THIS? if (session_is_registered($valid_session)) { Yep, that seems better. Thanks to both of you! Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.digitalprojects.com | http://www.iso-top.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 3 days 4 hours 10 minutes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]