By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,889 Members | 1,044 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,889 IT Pros & Developers. It's quick & easy.

register_global = on, mix between $_SESSION and local variables

P: n/a
Hi,
I'm coding Php under register_global = off flag, but, most (all ?) of php
hosting companies use the "on" flag with their shared servers...
I spent too much time to finally discover that my sessions went mad because
the $_SESSION['pseudo'] was updated by a simple $pseudo = $row['pseudo']
(from the DB)...
It's ok when, on my local conf, i use it with the register_global = off, but
once uploaded online, on a shared server with register_global = on, sessions
goes mad... I use the built-in php session mechanism and the file where
information session is saved is updated in a wrong way because of this
mix...

Is there another way for me than avoid using same names with my $_SESSION
stuff and other local variables ?

Thanks a lot,
Arnaud
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Undercat wrote:
Hi,
I'm coding Php under register_global = off flag, but, most (all ?) of php
hosting companies use the "on" flag with their shared servers...
I spent too much time to finally discover that my sessions went mad because
the $_SESSION['pseudo'] was updated by a simple $pseudo = $row['pseudo']
(from the DB)...
It's ok when, on my local conf, i use it with the register_global = off, but
once uploaded online, on a shared server with register_global = on, sessions
goes mad... I use the built-in php session mechanism and the file where
information session is saved is updated in a wrong way because of this
mix...

Is there another way for me than avoid using same names with my $_SESSION
stuff and other local variables ?

Thanks a lot,
Arnaud

You know you can use a .htaccess on your hosting platform to have Global
off just in the folder you want ? Some self-made security...

Something like...

<IfModule mod_php4.c>
php_flag register_globals off
</IfModule>

Aphrael
--
"La demande mondiale d’ordinateurs n’excédera pas cinq machines."
(Thomas Watson, Fondateur d'IBM, 1945)
Jul 17 '05 #2

P: n/a
Aphrael, being the foo Aphrael is, wrote:
Undercat wrote:
Hi,
I'm coding Php under register_global = off flag, but, most (all ?)
of php hosting companies use the "on" flag with their shared
servers...
I spent too much time to finally discover that my sessions went mad
because the $_SESSION['pseudo'] was updated by a simple $pseudo =
$row['pseudo'] (from the DB)...
It's ok when, on my local conf, i use it with the register_global =
off, but once uploaded online, on a shared server with
register_global = on, sessions goes mad... I use the built-in php
session mechanism and the file where information session is saved is
updated in a wrong way because of this mix...

Is there another way for me than avoid using same names with my
$_SESSION stuff and other local variables ?

Thanks a lot,
Arnaud

You know you can use a .htaccess on your hosting platform to have
Global off just in the folder you want ? Some self-made security...

Something like...

<IfModule mod_php4.c>
php_flag register_globals off
</IfModule>

Aphrael


Would that work for the entire website? Say I wanted to have
register_globals off as well but my host doesn't have it.

--
Sharif T. Karim
....you don't know wrath yet...
Jul 17 '05 #3

P: n/a
"Sharif T. Karim" <sh****@nyc.rr.com> emerged reluctantly from the
curtain and staggered drunkenly up to the mic. In a cracked and
slurred voice he muttered:
Aphrael, being the foo Aphrael is, wrote:
Undercat wrote:
Hi,
I'm coding Php under register_global = off flag, but, most
(all ?) of php hosting companies use the "on" flag with their
shared servers...
I spent too much time to finally discover that my sessions
went mad because the $_SESSION['pseudo'] was updated by a
simple $pseudo = $row['pseudo'] (from the DB)...
It's ok when, on my local conf, i use it with the
register_global = off, but once uploaded online, on a shared
server with register_global = on, sessions goes mad... I use
the built-in php session mechanism and the file where
information session is saved is updated in a wrong way because
of this mix...

Is there another way for me than avoid using same names with
my $_SESSION stuff and other local variables ?

Thanks a lot,
Arnaud

You know you can use a .htaccess on your hosting platform to
have Global off just in the folder you want ? Some self-made
security...

Something like...

<IfModule mod_php4.c>
php_flag register_globals off
</IfModule>

Aphrael


Would that work for the entire website? Say I wanted to have
register_globals off as well but my host doesn't have it.


..htaccess rules cascade to all sub-directories.

--
Phil Roberts | Without me its just aweso. | http://www.flatnet.net/

"Mankind differs from the animals only by a little,
and most people throw that away."
- Confucious
Jul 17 '05 #4

P: n/a
"Aphrael" <Aphrael@_ANTISPAMisuisse_com> a écrit dans le message de
news:40**********@news.bluewin.ch...
You know you can use a .htaccess on your hosting platform to have Global
off just in the folder you want ? Some self-made security...
Something like...
<IfModule mod_php4.c>
php_flag register_globals off
</IfModule>


Hi,
Yes, good idea, i'll try !

Thanks,
arnaud.
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.