php安全之直接用$获取值而不$_GET 字符转义

前端之家收集整理的这篇文章主要介绍了php安全之直接用$获取值而不$_GET 字符转义前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<div class="codetitle"><a style="CURSOR: pointer" data="37234" class="copybut" id="copybut37234" onclick="doCopy('code37234')"> 代码如下:

<div class="codebody" id="code37234">
<?
function my_addslashes($string,$force = 0) {
!defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC',get_magic_quotes_gpc());
if(!MAGIC_QUOTES_GPC || $force) {
if(is_array($string)) {
foreach($string as $key => $val) {
$string[$key] = my_addslashes($val,$force);
}
} else {
$string = addslashes($string);
}
}
return $string;
}
foreach(array('_COOKIE','_POST','_GET') as $_request) {
foreach($$_request as $_key => $_value) {
$key{0} != '' && $$_key = my_addslashes($_value);
}
}
echo $urls;
?>

原文链接:https://www.f2er.com/php/27171.html

猜你在找的PHP相关文章