當我將用戶輸入數據插入到我使用的mysql數據庫中時,mysql_real_escape_string
。輸入數據包含bbcode例如[img][/img]
。htmlentities或htmlspecialchars或stripslashes?哪一個使用?
下面是輸出html時的一行。
$information = $this->bbcode(stripslashes($this->swearfilter($row['information'])),1);
echo $information;
關於這個例子,這是正確的方式,以防止XSS攻擊或我使用htmlspecialchars($var,ENT_QUOTES)
或htmlentities
?