summaryrefslogtreecommitdiff
path: root/shell/no_magicquotes.php
diff options
context:
space:
mode:
Diffstat (limited to 'shell/no_magicquotes.php')
-rw-r--r--shell/no_magicquotes.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/shell/no_magicquotes.php b/shell/no_magicquotes.php
new file mode 100644
index 0000000..f6718eb
--- /dev/null
+++ b/shell/no_magicquotes.php
@@ -0,0 +1,26 @@
+<?php
+/* This was contributed by an awesome anonymous user in the comments section of
+ * the PHP manual on 17-Dec-2006 08:20
+ */
+if (get_magic_quotes_gpc()) {
+ function undoMagicQuotes($array, $topLevel=true) {
+ $newArray = array();
+ foreach($array as $key => $value) {
+ if (!$topLevel) {
+ $key = stripslashes($key);
+ }
+ if (is_array($value)) {
+ $newArray[$key] = undoMagicQuotes($value, false);
+ }
+ else {
+ $newArray[$key] = stripslashes($value);
+ }
+ }
+ return $newArray;
+ }
+ $_GET = undoMagicQuotes($_GET);
+ $_POST = undoMagicQuotes($_POST);
+ $_COOKIE = undoMagicQuotes($_COOKIE);
+ $_REQUEST = undoMagicQuotes($_REQUEST);
+}
+?>