whoisquilty wrote:
> When I insert into my database from a form, there are slashes added before
> quotes. What do
> I need to do to get rid of this?
>
>
As somebody else mentioned, you have a magic_quotes problem .... nasty
little invention but it will be gone in PHP6 ... finally ... anyway.
I am using the following function in my scripts to remove magic quotes.
I save it to a file called magic_quotes.php and then include the file at
the top of every script I run
require_once 'magic_quotes.php';
<?php
//This is here to deal with MagicQuotes source:
//http://usphp.com/manual/en/security.magicquotes.disabling.php
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
/*
if (get_magic_quotes_gpc()) {
echo("PHP Magic Quotes are enabled on your system. Please disable
this option in your php.ini file or your webhosting configuration page.");
} //if (!get_magic_quotes_gpc())
*/
?>
I test all my input fields with the strings below to test for database
handling and proper html translation problems:
slash/squote'dquote"seco;co:ti'bti`
<?PHP die('You are in trouble if the script ends right here'); ?>
[EMAIL PROTECTED]&*()_+
<b>This should not be bold</html>
There is only one slash here / and one backslash \ but there is no spoon
BrakesPHPorSQL: <?PHP ' AND `---1` == 1;"AND `---1` == 1;