Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Mar 2001
Posts: 644
Member
Member
Offline
Joined: Mar 2001
Posts: 644
Curiosity question here really...

I am planning on adding an app that someone else created to my site, but they require register globals to be on for it to function.

I understand that Threads works better with it off and if it is on there is a potential security risk. I plan to read up more on what register globals is in more detail, but I was curious to hear what you all thought about running with it on.

Is it bad? Good? Don't know? Don't care?

And, is there a way to run it both on AND off on the same server, but for different apps? (I'm fairly sure the answer is no, but I thought I'd toss the question out there anyway. )

Looking forward to your thoughts and comments.

Sponsored Links
Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
For the second part of your question. If you can use .htaccess files then you can enable/disable register globals on a per directory basis with:

php_flag register_globals on

or

php_flag register_globals off

As for my thoughts of running with it on. It depends on how the application is coded. If coded properly, running with register globals on isn't a big deal, but most applications don't quite cut it in this regard.

Here's the problem. Say you have a little script that looks like this:

Code
<br /><?<br /><br />$a = 1;<br />$b = 2;<br /><br />if ($a + $b = 4) {<br />   $c = 1;<br />}<br /><br />if ($c == 1) {<br />   echo "Hey, my math sucks, cuz 1 + 2 does not equal 4!";<br />}<br />?><br />


Now, normally what you'd expect to happen is nothing. Since $a + $b never equals 4 that echo statement will never be executed. But, with register globals on, all somebody would have to do would be to call your script like this:

http://www.yourdomain.com/scriptname.php?c=1

That injects the value for $c right into your script. Even though bit of code that sets $c in your script never gets executed. The problem is, that $c is never predefined and this is the problem with alot of scripts. Properly coded, that script would look like this:

Code
<br /><?<br /><br />// Predefine some variables<br />$c = 0;<br /><br /><br />$a = 1;<br />$b = 2;<br /><br />if ($a + $b = 4) {<br />   $c = 1;<br />}<br /><br />if ($c == 1) {<br />   echo "Hey, my math sucks, cuz 1 + 2 does not equal 4!";<br />}<br />?><br />


So now, even if register globals are on and someone tries to pass $c via the url, the script sets it to 0 at the beginning so that echo line will never be executed.

Hopefully, that makes a bit of sense. I can program but I can't explain things worth a pile of beans


UBB.threads Developer
Joined: Mar 2001
Posts: 644
Member
Member
Offline
Joined: Mar 2001
Posts: 644
Good enough for me Scream.

A friend and I sat down and looked at the app... then we coded the need for register globals right out of the darn thing.

But knowledge is good and I appreciate the answer. No register globals for me at this point.

Oh and btw, regarding the .htaccess... isn't that a Linux thing? I'm running on WIN2K, so, don't think it would work, unless I'm mistaken.

Thanks again!

Joined: Nov 2001
Posts: 745
Admin Emeritus
Admin Emeritus
Offline
Joined: Nov 2001
Posts: 745
If you are on Win2K, You would need to be running Apache on their instead of IIS if I'm not mistaken.

Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
okay heres a question.. how does UBBT pass the $config['yadayada'] variables from script to script? Through cookies? Sessions? Get and Post Http? Globals?

Sponsored Links
Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
At the top of each script you'll see where main.inc.php is included. That script includes all the config files, theme files, etc. that construct the config array and makes all of the config variables available to the script.


UBB.threads Developer
Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
cool thanx. yeah think I found that and am playing with " vs '...

Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
Yes it does work but you need as Ron said to be running Apache and have enabled the mod_rewrite module.


Nikos

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)