[thelist] Trouble with PHP Include

Santilal Parbhu santilal at scorpioneng.co.nz
Thu Feb 20 02:24:45 CST 2014


Hi Sarah & Dejan

Thanks so much for your advice.  I have spent about a week or more trying to
work out what was going on.  I just couldn't see how the same script could
behave so differently, and now armed with your advice I think I can solve my
problem and improve my code.

Cheers
Santilal


Santilal Parbhu
Scorpion Engineering Limited
PO Box 171
Alexandra
Phone: +64 3 440 2100
Mobile: +64 21 2655991
Email: santilal at scorpioneng.co.nz
Web: www.scorpioneng.co.nz
-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Sarah Adams
Sent: Wednesday, 19 February 2014 2:46 a.m.
To: thelist at lists.evolt.org
Subject: Re: [thelist] Trouble with PHP Include

> 1.  Is it only declared session variables that become global or all 
> variables.  In my case it kind of looked like all variables.

All variables become global. I don't know why anyone ever thought this would
be a good idea.

> 2. Should you use session_unset() at the end when logging out of the 
> session?

I think you might want to use session_destroy(), actually, but do some
reading on this before taking my word for it :)

> 3. Even if register_globals is on, and  if I use the code $clubdraws = 
> $_SESSION['clubdraws']; will this ensure that $clubdraws has the value 
> that I intended it to have.  i.e. is it a safer way to write the script?

Absolutely this is the best way to do it. That's the problem with
register_globals, it makes it so you can never be totally sure where your
variables are coming from (e.g. if the same variable appeared in the query
string), so setting it explicitly is the way to go. While you are still
using your host that has register_globals on you might even be better off to
use a different local variable name altogether.

Sarah
-- 

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester and archives
of thelist go to: http://lists.evolt.org Workers of the Web, evolt ! 



More information about the thelist mailing list