Re: [PHP] Another Session Question

From: Al (news_at_ridersite.org)
Date: 12/31/03


To: php-general@lists.php.net
Date: Wed, 31 Dec 2003 13:01:54 -0500

Your'e right, that's a typo.

If I put a

echo $_SESSION['counter_file'] .
' testxxxxxxxxx ' . $counterFile;

Before and after the conditional, $_SESSION['counter_file'] is set after the conditional, as it should be. But, it is gone from the before echo when the function is recalled.

The Session buffer looses the value.

session_start() is called again before returning to the function; but, I thought repeated session_starts() were ignored and thus should not restart the session.

I use the session buffer extensively in other places without any problem.

Matt Matijevich wrote:

>[snip]
>session_start();
>
> if($_SESSION['counter_file'] !==$counterFile) //See if
>visitor has already been counted for this page
> {$num += 1;
> $_SESSION['counter_file'] = $counterFile;
> }
>
>echo $_SESSION['counterFile'] . ' testxxxxxxxxx ' . $counterFile;
>[/snip]
>
>might just be a typeo but do you mean: echo $_SESSION['counter_file'] .
>' testxxxxxxxxx ' . $counterFile;
>instead of this: echo $_SESSION['counterFile'] . ' testxxxxxxxxx ' .
>$counterFile;
>?
>
>