在php5的环境中我们的$_SERVER变量将不再受magic_quotes_gpc的保护,至于程序该如何加强自己的安全性,下面我们总结了怎么保护php中的cookie,get,post,files数据哦,有需要的朋友可参考一下。
代码如下 |
复制代码 |
$magic_quotes_gpc = get_magic_quotes_gpc();
@extract(daddslashes($_COOKIE));
@extract(daddslashes($_POST));
@extract(daddslashes($_GET));
if(!$magic_quotes_gpc) {
$_FILES = daddslashes($_FILES);
} |
daddslashes函数
代码如下 |
复制代码 |
//转译字符函数
function daddslashes($string) {
if(!is_array($string)) return addslashes($string);
foreach($string as $key => $val) $string[$key] = daddslashes($val);
return $string;
}
|
?>
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn