<html>
<head>
<title>mysql注入漏洞测试</title>
</head>
<body>
<?php
$mysql_server_name='localhost';
$mysql_username='root';
$mysql_password='shanmao';
$conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password)
or die('Could not connect:'.mysql_error());
mysql_select_db('test') or die('Could not select database');
$aid = $_GET['id'];
$query="select * from hehe where id=$aid";
$result =mysql_query($query) or die('Query failed:'.mysql_error());
echo "<table>\n";
$row=mysql_fetch_assoc($result);
echo $row["id"];
echo $row["content"];
mysql_free_result($result);
mysql_close($conn);
?>
</body>
</html>
转载于:https://www.cnblogs.com/shanmao/archive/2012/11/16/2772780.html
本文展示了一个使用PHP和MySQL的简单网页应用代码,其中包含一个明显的SQL注入漏洞。通过直接将用户输入拼接到SQL查询中,该应用暴露了安全风险,为攻击者提供了利用的机会。
1437

被折叠的 条评论
为什么被折叠?



