If you can use a .htaccess, then it's very simple...
php_flag register_globals off
Otherwise, this code seems to do the job :
<?php
echo '<pre>';
$arrKeep = array('GLOBALS', '_GET', '_POST', '_FILES', '_COOKIE', 'arrKeep');
$strDelete = 'Delete me !';
print_r($GLOBALS);
foreach(array_keys($GLOBALS) as $strKey) {
if(!in_array($strKey, $arrKeep)) {
unset($GLOBALS[$strKey]);
}
}
unset($strKey);
unset($arrKeep);
print_r($GLOBALS);
?>