Re: Sessions & Headers [AGAIN!]
| From: | Teodor Cimpoesu | Date: | Wed, 20 Dec 2000 19:20:41 +0000 |
| Subject: | Re: Sessions & Headers [AGAIN!] | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31278@lists.php.net to get a copy of this message | ||
Hi Soma!
On Wed, 20 Dec 2000, Soma Interesting wrote:
> Is there a means to be able to check for a valid session id - checking if
> it is already active in the system. If there is none - rather than
if (session_id() =='') {
echo "session not started";
}
> immediately starting a session (as is the default behavior of PHP) then
> allow another action - such as a log-in screen via a http redirect - which
> if successful then a new session id is assigned.
>
> It would seem a straight forward enough task - for anyone who understood
> the internals of PHP's sessions handling. Possibly there is even an array
> of all existing session ID living within PHP that we could work with. Or -
> by default the session information is saved to a text file - if none of the
> session information is stored within PHP as an accessible array or object
> (or something) - then maybe we can read the text file, parse out the
> session id's and then store them in an array for this purpose. Of course at
> that point it starts to sound like a lot of work. :(
I noticed in the first call you have SID defined to
"<session_name>=<session_id>"
try this:
<?
session_start(); // comment this line to check behaviour
if (session_id() == '') {
echo "session not started";
}
else {
echo "session active";
}
printf ("<br>SID is : [%s]",SID);
besides checking HTTP_{GET,COOKIE}_VARS for the session_name() variable/cookie
which is just session_id() does I dunno what else.
hope it helped.
cheers,
-- teodor