PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 30th, 2002, 10:52 PM
webhappy webhappy is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Silicon Valley, CA, USA
Posts: 203 webhappy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Is using register_globals() worth the hassle?

I just spent a half-hour converting the easy scripts (<5 variables passed in) to work with register_globals off.

The way I'm doing it is like this:
$neededVar = $_REQUEST['varname'];

But I'm really starting to doubt the point of regster_globals(). I saw that one example, where a user could easily inject a false verification. However, such an attack is defeated if you're used to C++ or Java, where you must initialize variables. Thus, they can inject whatever they want, but you'll be redefining the vars to something, or mostly likely to an empty string.

$authenticated=false;

if ( check login here )
$authenticated=true;

If ( $authenticated )
{
echo "here ya go...";
}

Basically, why burn extra hours, when you can fix the bad coding, with a line that takes a few seconds to type?

Reply With Quote
  #2  
Old August 30th, 2002, 11:17 PM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: Is using register_globals() worth the hassle?

Well, I agree with what you are saying. If you write secure code (and you KNOW you do), then there really isn't a reason to make the switch. I think this paragraph from the 4.1.0 release notes sums it up well:
Quote:
While it is quite possible to write secure code in PHP, we felt that the fact that PHP makes it too easy to write insecure code was bad, and we've decided to attempt a far-reaching change, and deprecate register_globals. Obviously, because the vast majority of the PHP code in the world relies on the existence of this feature, we have no plans to actually remove it from PHP anytime in the foreseeable future, but we've decided to encourage people to shut it off whenever possible.


That's what the problem is, too many people are coding sloppy. And because of that there are gaping security holes out there....


Reply With Quote
  #3  
Old September 2nd, 2002, 10:55 PM
Nimco Nimco is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 132 Nimco User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Nimco
RE: Is using register_globals() worth the hassle?

For an easy solution, see my code snippet in the Zend code gallery (register_globals patch) in the HTTP > Forms category.

It still keeps the script secure, without having to worry about mass patching - just insert the script (2 lines) into each page at the top and you're done...

Reply With Quote
  #4  
Old September 4th, 2002, 03:41 AM
webhappy webhappy is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Silicon Valley, CA, USA
Posts: 203 webhappy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Is using register_globals() worth the hassle?

Ah, I already "patched" my code up:

foreach ( $_REQUEST as $key => $val )
$$key = $val;


Thanks though.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Is using register_globals() worth the hassle?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway