本文共 8880 字,大约阅读时间需要 29 分钟。
CREATE TABLE users ( id int(11) NOT NULL AUTO_INCREMENT, username varchar(64) NOT NULL, password varchar(64) NOT NULL, email varchar(64) NOT NULL, PRIMARY KEY (id), UNIQUE KEY username (username) ); |
<html> <head> <title>Sql注入演示</title> <meta http-equiv="content-type" content="text/html;charset=utf-8"> </head> <body > <form action="validate.php" method="post"> <fieldset > <legend>Sql注入演示</legend> <table> <tr> <td>用户名:</td> <td><input type="text" name="username"></td> </tr> <tr> <td>密 码:</td> <td><input type="text" name="password"></td> </tr> <tr> <td><input type="submit" value="提交"></td> <td><input type="reset" value="重置"></td> </tr> </table> </fieldset> </form> </body> </html> |
<html> <head> <title>登录验证</title> <meta http-equiv="content-type" content="text/html;charset=utf-8"> </head> <body> <?php $conn=@mysql_connect("localhost",'root','') or die("数据库连接失败!");; mysql_select_db("injection",$conn) or die("您要选择的数据库不存在"); $name=$_POST['username']; $pwd=$_POST['password']; $sql="select * from users where username='$name' and password='$pwd'"; $query=mysql_query($sql); $arr=mysql_fetch_array($query); if(is_array($arr)){ header("Location:manager.php"); }else{ echo "您的用户名或密码输入有误,<a href=\"Login.php\">请重新登录!</a>"; } ?> </body> </html> |
转载地址:http://yjzua.baihongyu.com/