我试图通过删除表(用户)来测试针对我的网站的 SQL 注入,但它不起作用。
我的sql字符串语法:
String sql = "select * from users where username='" + username + "' and password='" + password + "';";
Run Code Online (Sandbox Code Playgroud)
我输入jack用户名字段和
test'; DROP TABLE users; --密码字段并得到以下 sql 字符串:
select * from users where username='jack' and password='test'; DROP TABLE users; --';
然后我执行它:
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(sql);
Run Code Online (Sandbox Code Playgroud)
但它不起作用,知道为什么吗?