0
任何人都可以提供如何從SQL注入安全這個PHP腳本的任何建議:我如何保護這個PHP腳本?
<?php
include("config.php");
if(isset($_POST['lastmsg']))
{
$lastmsg = mysqli_real_escape_string($_GET['lastmsg']);
$result=mysql_query("select * from messages where msg_id<'$lastmsg' order by msg_id desc limit 9");
$count=mysql_num_rows($result);
while($row=mysql_fetch_array($result))
{
$msg_id=$row['ms_gid'];
$message=$row['message'];
?>
<li>[
<?php echo $message; ?>
</li>
<?php
}
?>
<div id="more<?php echo $msg_id; ?>" class="morebox">
<a href="#" id="<?php echo $msg_id; ?>" class="more">more</a>
</div>
<?php
}
?>
謝謝:)
是'lastmsg'POST或GET變量嗎?你引用了兩種不同的方式。 – 2011-04-15 19:26:09
它的一個帖子,抱歉只是注意到了。謝謝:) – user663049 2011-04-15 19:29:38
** [PDO](http://php.net/manual/en/book.pdo.php)**。學習它,使用它。 – meagar 2011-04-15 19:54:44