如果不输入

 随便输入

 由地址栏的check.php?username=sadsad&password=sadsad可以猜测sql语句:

$sql="select * from xx where username='$name' and password='$password'";

既然是考sql注入,先试试万能密码

用户名:’ or 1#

密码随意

判断是否正确的sql语句可能为:$sql="select * from xx where username='$name' and password='$password'";

当输入' or 1#会变为:select * from xx where username='' or 1 # 'and password='$password'

#为sql语句的注释符,#后面的会被注释掉

即$sql="select * from xx where username='' or 1 ";(username='' 是两个单引号);

这样也就不需要密码正确与否了。

 成功拿到flag