|
Posted by Alvaro G Vicario on 09/05/05 10:55
*** Name wrote/escribió (Fri, 02 Sep 2005 16:07:00 GMT):
> <?
> session_start();
> session_register("count");
> $count=$count+1;
You modify $count *after* storing it in session data?
> echo $count;
> ?>
[...]
> session.register_globals=1
> When I run this, count always displays as 1.
From manual:
"If you want your script to work regardless of register_globals, you need
to instead use the $_SESSION array as $_SESSION entries are automatically
registered. If your script uses session_register(), it will not work in
environments where the PHP directive register_globals is disabled."
I particularly find it very easy to write insecure scripts when
register_globals is set to 'on' so I always use $_SESSION. I don't think it
worth trying to debug a script that relies on register_globals.
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Navigation:
[Reply to this message]
|