[thelist] Trouble with PHP Include

Santilal Parbhu santilal at scorpioneng.co.nz
Mon Feb 17 20:34:34 CST 2014


Hello Sarah and Nadeem

Thank you for your advice.  As it turned out I had just thought of this and
I ran phpinfo() to see what the register_globals was set to.  On the hosted
version it was set to "on" and on my XAMPP version it was set to "off".  So
thank you for confirming my thinking.  I am a real beginner at this and I
only know enough to do what I need to do (and get myself into trouble).

I don't think I can change the hosted version, but I did do some testing on
my version.  I got some weird results when I turned it on, and it was hard
to pick what was happening.  However, with the added code to make the
assignments, it worked every time with it turned off.  Can you tell me the
following.

1.  Is it only declared session variables that become global or all
variables.  In my case it kind of looked like all variables.
2. Should you use session_unset() at the end when logging out of the
session?
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?

Thanks.

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: Tuesday, 18 February 2014 2:31 a.m.
To: thelist at lists.evolt.org
Subject: Re: [thelist] Trouble with PHP Include

>
> Thank you Lee and Anthony for your help.  I think you are on to it, 
> Lee.  I think it is a flaw in my logic somewhere.  You see I have 
> these scripts running on a hosted server.  I am adding some features 
> which I am testing on my XAMPP server.  The script runs perfectly on 
> the hosted server, but for some reason I have to add the following 
> assignments to the XAMPP version.
>
> $clubdraws = $_SESSION['clubdraws'];
> $clubresults = $_SESSION['clubresults']; $clublogin = 
> $_SESSION['clublogin'];
>
> Obviously this assignment must be happening somewhere on the hosted 
> script, otherwise it wouldn't work.  But it is not in the current 
> script so it must be in an included script, but I can't find it.  I 
> will have to do some detective work.  With your help I have managed to 
> narrow the issue down to something I have done rather than something 
> not working correctly.  Thanks again.
>

It sounds like your host may have an older version of PHP with
register_globals turned on.
http://www.php.net/manual/en/security.globals.php
That would cause your session variables to be global so that you would be
able to access them without using $_SESSION['var'].

If you determine that this is the case, I recommend turning register_globals
off... but you have to be careful doing so, as you can see, your code up to
now may be depending on having it turned on.

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