幾年前,我用做一些類似的對我的腳本的頂部:PHP:今天仍然相關的基本sanitzation?
ini_set('magic_quotes_runtime', 0);
ini_set('magic_quotes_sybase', 0);
ini_set('url_rewriter.tags', '');
ini_set('session.use_trans_sid', 0);
function clean_input ($arr)
{
if (!get_magic_quotes_gpc())
$arr = array_map('addslashes', $arr);
return $arr;
}
$_GET = clean_input($_GET);
$_POST = clean_input($_POST);
$_COOKIE = clean_input($_COOKIE);
$_REQUEST = clean_input($_REQUEST);
此仍然適用今天至少在PHP 5.2?
此外,我們今天需要的最低基本衛生設施是什麼?
你不應該在任何版本的PHP中執行它:http://stackoverflow.com/questions/58694/how-do-i-html-encode-all-the-output-in-a- web-application/60690#60690 –
魔術引號在PHP 5.3中被棄用,並且在PHP 5.4中被刪除! –