mysql - Can sql injection be avoided by simply escaping single quotes and backslashes without using a prepare statement?
PHPz
PHPz 2017-05-18 10:48:57
0
1
752

For example, if I enter the login name login_name as \', I will spell out this SQL:

  SELECT * FROM account WHERE (1) AND (`account`.login_name = '\\'') 

Enter the login name login_name as ' or 1 = 1 to spell out this SQL:

SELECT * FROM account WHERE (1) AND (`account`.login_name = '\' or 1 = 1') 

Can this avoid sql injection?

PHPz
PHPz

学习是最好的投资!

reply all(1)
PHPzhong

No, suppose login_name is ' or 1 = 1, what is the result after escaping?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!