标签:bWAPP之sqli_16.php Login Form/User SQL注入登录
SQL Injection (Login Form/User),这个注入真的让我崩溃,说好的单引号报错后,相应的改SQL语句,然而并没用,然后求助身边的大牛,他说这个好像不一样,曾经好像是一道CTF的题,和一般的SQL注入不一样,但是一时想不起来怎么秀的了,然后终于想了起来,接着带着我一顿操作,终于明白是怎么回事了。部分代码如下:
<?php
if(isset($_POST["form"]))
{
$login = $_POST["login"];
$login = sqli($login);
$password = $_POST["password"];
$password = sqli($password);
$password = hash("sha1", $password, false);
$sql = "SELECT * FROM users WHERE login = ‘" . $login . "‘";
// echo $sql;
$recordset = mysql_query($sql, $link);
if(!$recordset)
{
die("Error: " . mysql_error());
}
else
{
$row = mysql_fetch_array($recordset);
if($row["login"] && $password == $row["password"])
{
// $message = "<font color=\"green\">Welcome " . ucwords($row["login"]) . "...</font>";
$message = "<p>Welcome <b>" . ucwords($row["login"]) . "</b>, how are you today?</p><p>Your secret: <b>" . ucwords($row["secret"]) . "</b></p>";
// $message = $row["login"];
}
else
{
$message = "<font color=\"red\">Invalid credentials!</font>";
}
}
mysql_close($link);
}
echo $message;
?>
标签:bWAPP之sqli_16.php Login Form/User SQL注入登录
原文地址:http://blog.51cto.com/13577444/2092910