What do people use stripslashes for and is it typically used in conjunction with addslashes? Why should I strip or add slashes to a string that’s submitted by a user?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should always sanitize the user’s input. But not with
addslashes()… If you want to compose a query with the user’s input, use the proper database escaping mechanism (look intomysql_real_escape_string()and PDO prepared statements).The reason for sanitizing user input is security. Read about SQL injection and cross-site scripting, which are the two most common security problems arising from un-sanitized input.