Web Tool Bag
Home · Articles · Downloads · Discussion Forum · Web Links · News CategoriesMarch 12 2010 06:45:49
Navigation
Home
Articles
Downloads
Discussion Forum
Web Links
News Categories
Search
Users Online
Guests Online: 5
No Members Online

Registered Members: 154
Unactivated Members: 9
Newest Member: KATIE27
Function that removes all the globals added by register_globals
To expand on the nice bit of code Mike Willbanks wrote and Alexander tidied up, I turned the whole thing in a function that removes all the globals added by register_globals so it can be implemented in an included functions.php and doesn't litter the main pages too much.

<?php
//Undo register_globals
function unregister_globals() {
    if (
ini_get(register_globals)) {
       
$array = array('_REQUEST', '_SESSION', '_SERVER', '_ENV', '_FILES');
        foreach (
$array as $value) {
            foreach (
$GLOBALS[$value] as $key => $var) {
                if (
$var === $GLOBALS[$key]) {
                    unset(
$GLOBALS[$key]);
                }
            }
        }
    }
}
?>

Posted by zdravko on August 20 2008 08:36:05 420 Reads · Print
Ratings
Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Shoutbox
You must login to post a message.

No messages have been posted.
Copyright © 2009 - www.webtoolbag.com