php防注入代码方法一:
$value) { if (eregi($value,$strfiltrate)) { return true; } } return false;}//合并$_post 和 $_getif(function_exists(array_merge)){ $arrpostandget=array_merge($http_post_vars,$http_get_vars);}else{ foreach($http_post_vars as $key=>$value) { $arrpostandget[]=$value; } foreach($http_get_vars as $key=>$value) { $arrpostandget[]=$value; }}//验证开始foreach($arrpostandget as $key=>$value){ if (funstringexist($value,$arrfiltrate)) { echo ; if (emptyempty($strgourl)) { echo ; } else { echo ; } exit; }}?>
php防注入代码方法二:
$get_var){if (is_numeric($get_var)) {$get[strtolower($get_key)] = get_int($get_var);} else {$get[strtolower($get_key)] = get_str($get_var);}}/* 过滤所有post过来的变量 */foreach ($_post as $post_key=>$post_var){ if (is_numeric($post_var)) { $post[strtolower($post_key)] = get_int($post_var); } else { $post[strtolower($post_key)] = get_str($post_var); }}/* 过滤函数 *///整型过滤函数function get_int($number){ return intval($number);}//字符串型过滤函数function get_str($string){ if (!get_magic_quotes_gpc()) { return addslashes($string); } return $string;}?>
http://www.bkjia.com/phpjc/752508.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/752508.htmltecharticle介绍两种方法吧,首先请把以下代码保存为safe.php放在网站根目录下,然后在每个php文件前加include(/safe.php);即可: php防注入代码方法一:...
