note 94757 deleted from security.magicquotes.disabling by danbrown
| From: | danbrown@php.net | Date: | Mon, 23 Nov 2009 15:34:02 +0000 |
| Subject: | note 94757 deleted from security.magicquotes.disabling by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-163191@lists.php.net to get a copy of this message | ||
Note Submitter: eugene at ultimatecms dot co dot za
----
<?php
function no_magic_quotes($query) {
$data = explode("\\",$query);
$cleaned = implode("",$data);
return $cleaned;
}
// I'm using mysql_escape_string as a simple example, but this function would work for any
escaped string.
$query = "It's amaizing! Who's to say this isn't a simple function?";
$badstring = mysql_escape_string($query);
echo '<b>Without funtion:</b> '.$badstring;
echo '<br><br>';
echo '<b>With function:</b> '.no_magic_quotes($badstring);
?>
Output:
Without funtion: It\'s amaizing! Who\'s to say this isn\'t a simple function?
With function: It's amaizing! Who's to say this isn't a simple function?