cvs: phpweb /include prepend.inc
| From: | Gabor Hojtsy | Date: | Sat, 14 Dec 2002 19:38:03 +0000 |
| Subject: | cvs: phpweb /include prepend.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-14185@lists.php.net to get a copy of this message | ||
goba Sat Dec 14 14:38:03 2002 EDT
Modified files:
/phpweb/include prepend.inc
Log:
Add unset_variables() for future use
Index: phpweb/include/prepend.inc
diff -u phpweb/include/prepend.inc:1.11 phpweb/include/prepend.inc:1.12
--- phpweb/include/prepend.inc:1.11 Sat Dec 14 14:05:41 2002
+++ phpweb/include/prepend.inc Sat Dec 14 14:38:03 2002
@@ -49,4 +49,25 @@
return TRUE;
}
+// Unset all variables except common ones we use
+// to access request variables and the globals array
+// If all files are register_globals = off safe, then
+// this function can be called to get rid of all
+// variables, even if register_globals = on
+function unset_variables()
+{
+ // Protect some common variables
+ $protected = array(
+ '_GET', '_POST', '_COOKIE', '_SERVER',
+ '_ENV', '_REQUEST', 'GLOBALS',
+ );
+
+ // Go through all global variables
+ foreach ($GLOBALS as $name => $value) {
+ if (!in_array($name, $protected)) {
+ unset($GLOBALS[$name]);
+ }
+ }
+}
+
?>