![]() |
Emulating Behaviour Of "mysql_real_escape_string"
I need to stop mysql injections in Python's mysql library. However, mysql_real_escape_string does not exist for Python's wrapper for MySQL. Therefore, I need to emulate the behaviour of PHP's mysql_real_escape_string.
Does this cover all the bases? :
def mysql_real_escape_string(string)::
mysql_real_escape_string(" ' or username is not null or username=' "):
\' or username is not null or username=\' |
Re: Emulating Behaviour Of "mysql_real_escape_string"
You can stop SQL injections by using parameters, e.g:
:
cursor.execute("SELECT * FROM users WHERE login = '%s' AND passwd = '%s'", (login, passwd)) |
Re: Emulating Behaviour Of "mysql_real_escape_string"
I'll have to rework everything, but I guess it's better to use something tried and tested anyways. Thanks.
|
| All times are GMT -5. The time now is 3:20 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC