note 62563 added to function.get-magic-quotes-gpc
| From: | acid369 at gmail dot com | Date: | Fri, 03 Mar 2006 14:36:59 +0000 |
| Subject: | note 62563 added to function.get-magic-quotes-gpc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104771@lists.php.net to get a copy of this message | ||
I've wrote a simple function to slash everything submitted via a form which I use a lot,
especially if I'm inserting into MySQL.
<?php
function SlashMagicQuotes(&$Array) {
if (!get_magic_quotes_gpc()) {
foreach ($Array as $ArrayKey => $ArrayValue) {
$Array[$ArrayKey] = addslashes($ArrayValue);
}
}
}
?>
Call with:
<?php SlashMagicQuotes($_POST); ?>
Just replace $_POST with $_GET or $_REQUEST depending on your script, saves having to check
variables individually.
----
Server IP: 84.18.202.180
Probable Submitter: 62.6.139.9 (proxied: 195.106.150.1)
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.get-magic-quotes-gpc.php
Edit -- http://master.php.net/note/edit/62563
Del: integrated -- http://master.php.net/note/delete/62563/integrated
Del: useless -- http://master.php.net/note/delete/62563/useless
Del: bad code -- http://master.php.net/note/delete/62563/bad+code
Del: spam -- http://master.php.net/note/delete/62563/spam
Del: non-english -- http://master.php.net/note/delete/62563/non-english
Del: in docs -- http://master.php.net/note/delete/62563/in+docs
Del: other reasons-- http://master.php.net/note/delete/62563
Reject -- http://master.php.net/note/reject/62563
Search -- http://master.php.net/manage/user-notes.php