1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<html>
<body>
<form id=“form1″ name=“form1″ method=“post” action=“login.php”>
<label>UserName
<input name=“user” type=“text” id=“user”/>
</label>
<br/>
<label>Password
<input name=“password” type=“text” id=“password”/>
</label>
<br/>
<label>
<input name=“login” type=“submit” id=“login” value=“Login”/>
</label>
</body>
</html>
|
(2)认证处理login.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<?php
if(isset($_POST[“login”]))
{
$link = mysql_connect(“localhost”,“root”,“toor”) or die (“cannot connect database”.mysql_error());
mysql_select_db(“member”) or die (“cannot select the db”);
$query = “select * from user where user=’”.$_POST[“user”].“‘and password=’”.md5($_POST[“password”]).“‘”;
echo $query.“<br/>”;
$result = mysql_query($query) or die (“the query failed:”.mysql_error());
echo “<br/>”;
$match_count = mysql_num_rows($result);
if($match_count){
while($row = mysql_fetch_assoc($result)){
echo “<strong>User: </strong>”.$row[“user”].“<br/>”;
echo “<strong>Password: </strong>”.$row[“password”].“<br/>”;
echo “<br/>”;
}
}
else {
echo “Wrong User or password <br/>”;
echo ‘<a href=”http://10.1.36.34/login.html”>Back</a><br/>’;
}
mysql_free_result($result);
mysql_close($link);
}
|
注意红色字体部分,为用户输入的用户名和密码,没有进行任何过滤就传入到数据库中去进行查询. 该脚本将查询字符串及查询结果展示在页面中以供直观的演示SQL查询结果。
(2)输入用户名45a’+’b’#
”-”对应的数值为0 -0 =0,会把user对应数值为0的搜索出来
Copyright © hongdaChiaki. All Rights Reserved. 鸿大千秋 版权所有
联系方式:
地址: 深圳市南山区招商街道沿山社区沿山路43号创业壹号大楼A栋107室
邮箱:service@hongdaqianqiu.com
备案号:粤ICP备15078875号