Re: Sanitizing potential MySQL strings with no database connection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> So, actually taking a minute to read up on addcslashes(), it is a rather handy
> little function.
>
> Taking the list of characters that mysql_real_escape_string() says it escapes:
>
> http://us3.php.net/mysql_real_escape_string
>
> Which it lists: \x00, \n, \r, \, ', " and \x1a
>
> \0  = \x0
> \10 = \n
> \13 = \r
> \92 = \
> \44 = '
> \34 = "
> \26 = \x1a
>
> You could do something like this.
>
> function cleaner($input) {
>        return addcslashes($input, "\0\10\13\92\44\34\26");
> }
>
> Maybe this will help...
>
> Jim
>

So far as I understand mysql_real_escape_string() was invented because
addslashes() is not adequate.


-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux