登陆验证注入:
//万能用户名失效
//万能密码 xx' or 1='1
//万能用户名 xxx' union select * from users/*
$sql="select * from users where username='$username' and password='$password'";
//万能密码 33 union select * from users
//万能用户名 89 union select * from users;/*
$sql="select * from users where username=$username and password=$password";//$username不加‘’,只能表示数字,否则sql语句有错,这种写法不可以使用
/*
* 防范:
* 1:服务器配置 设置php.ini的magic_quotes_gpc为on
* 2:密码比对
* 3:pdo php.ini php_pdo_XXSQL.dll
* 4:入侵检测系统IDS
* */
密码比对防止注入
$sql="select password from users where username='$username'";
$res=mysql_query($sql,$conn);
if($row=mysql_fetch_array($res)){
if($row[0]==$password){