比如说:

String sql = "select * from clients where logname='" + name + "'and password='" + pwd+" '" ;

SQL中只支持单引号,表示字符串常量

SQL中的双引号用于表示字符串

两个加号是连接字符串

最终生成的SQL是
select * from clients where logname='xxx' and password='yyy';

 

上面的写法存在sql注入漏洞:

select * from clients where logname='xxx' and password='yyy' or 1='1';

相关文章:

  • 2022-12-23
  • 2021-12-22
  • 2021-10-16
  • 2022-12-23
  • 2021-05-08
  • 2021-05-17
  • 2022-02-20
猜你喜欢
  • 2021-08-09
  • 2022-12-23
  • 2021-07-15
  • 2022-01-04
  • 2021-06-18
相关资源
相似解决方案