ホームページ >バックエンド開発 >PHPチュートリアル > sql注入失败
高手进 sql注入失败!
自己写的登陆,测试sql注入,在数据库测试可以,但在这老是失败,求指教!
login.php
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>登陆界面-SQl注入测试</title>
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php $username = $_REQUEST['username'];$password = $_REQUEST['password'];$conn=mysql_connect('localhost','root','315824');if(!$conn){ echo "数据库连接失败".mysql_error();}mysql_select_db('test',$conn);$sql="select * from users where username='$username' and password='$password'";$res=mysql_query($sql,$conn);if( mysql_num_rows($res) != 0 ){ header("location:manageCenter.php");}else{ echo "用户名或密码错误,<a href='login.php'>重新登陆";}?>
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>管理中心</title>欢迎管理员,管理中心!