我想用PHP/Mysql注入一個登錄示例,我的代碼如下。PHP MySQL注入示例?
我曾嘗試與anything' --
用戶名和密碼爲空,但它不工作,我無法登錄。
誰能幫助我?
<?php
mysql_connect('localhost','root','root');
mysql_select_db('hp');
?>
<form action="" method="post">
<table width="50%">
<tr>
<td>User</td>
<td><input type="text" name="user"></td>
</tr>
<tr>
<td></td>
<td><input type="text" name="password"></td>
</tr>
</table>
<input type="submit" value="OK" name="s">
</form>
<?php
if($_POST['s']){
$user = $_POST['user'];
$pass = $_POST['password'];
$re = mysql_query("select * from zend_adminlist where user_name = '$user' and password = '$pass'");
if(mysql_num_rows($re) == 0){
echo '0';
}else{
echo '1';
}
}
?>
不重複。他想注射,而不是阻止。 – itachi
@itachi無論如何它太本地化了。 –
@itachi如果您閱讀文章,問題顯示SQL注入,並且答案是預防。 –