stripslashes () is commonly used for servers with Magic Quotes enabled. Since Magic Quotes is deprecated (and not recommended), what you are probably looking for is addlashes (), which prevents SQL injections. For example, if your SQL statement reads:
SELECT * FROM users WHERE username='$username' AND password = '$password'
without addlashes (), you can execute SQL Injection by setting the username:
admin'
So, in other words, addslashes () - or better yet, mysql_real_escape_string () is for preventing SQL injection, and strip_tags () is for preventing XSS injection.
jusunlee
source share