I've been reading about the new register_globals setting in the PHP docs and want to spark some discussion about why the change was set in place and best practices to code to the standard...
It seems like ultimately it's WHAT you do w/ the form data that will determine how secure your script is...if you do a work around like extract($POST); or even $foo = $POST["foo"]; w/o testing the data you're gone.
The big advantage of turning register_globals off is that it prevents a black hat from hijacking an internal script variable ... like
<form action="foo.php" method="post">
<input type="hidden" name="action" value="new" />
<input type="submit" name="submit" value="submit" />
</form>
<?php
if($action == "new")
{
$header = "All Right!";
$body = "blah...";
mail(...............);
}
?>
blackhat could w/ register_globals on do:
http://myurl.com/foo.php?action=new&header=You%20Suck&body=My%20Big%20Fat%20Rooster
although in this case they'd be overwritten. But a script w/ file access could be vulnerable. So basically you're shuffling these post/get/server/env vars into a temp array for you to pull on an as-needed basis. But I see no benefit beyond that - this change doesn't make things "secure" by itself, as some think.