Re: registering variables in session (arrays too)
| From: | Cynic | Date: | Mon, 25 Sep 2000 22:44:04 +0000 |
| Subject: | Re: registering variables in session (arrays too) | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-2786@lists.php.net to get a copy of this message | ||
Why the hell wouldn't registering variables in custom functions
work? Try this (slightly altered manual snippet), it works on
my host:
<?php
function sessreg( $v )
{
session_register($v) ;
} ;
#session_register ("count");
sessreg('count') ;
$count++;
if ( $count == 15 ) {
session_destroy() ;
} ;
i?>
Hello visitor, you have seen this page <? echo $count; ?> times.<p>
<?php
/* the <?=SID?> is necessary to preserve the session id
* in the case that the user has disabled cookies
*/
?>
To continue, <A HREF="test.php<?=SID?>">click here</A>
At 07:55 PM 9/21/00 +0200, Sebastian Baran wrote the following:
--------------------------------------------------------------
>Hello All,
>
>I already know why I can't register arrays in session. I found, that I
>couldn't register normal variable too. And then, eureka!!! I did all
>those registering in function! I moved session_register outside
>function and it works fine (arrays to!). So I checked bug database and
>found bug id #3111 that matches my problems. And answer from sas@cvs.php.net
>:
>"session variables must be global variables"
>
>No comments.
>Why the hell nobody put this comment into manual???????????
>I've lost few hours trying to register local variable from function.
>
>Where I should send e-mail to somebody put this sentence into manual?
>
>--
>Sebastian Baran, Poland
>mailto:sebab@info.com.pl
>
>
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
>For additional commands, e-mail: php-windows-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
------end of quote------
____________________________________________________________
Cynic:
A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.
cynic@mail.cz
ICQ: 2808 2505