Home >Backend Development >PHP Tutorial >Analysis of the difference between PHP function addslashes and mysql_real_escape_string
Example, simulation only What happens when query data is escaped using addslashes (or magic_quotes_gpc):
Despite using addslashes, I can successfully log in without knowing the username and password. This vulnerability can be easily exploited for SQL injection. To avoid this vulnerability, use mysql_real_escape_string, prepared statements (Prepared Statements, or "parameterized queries"), or any of the mainstream database abstraction libraries. |