Introduce two methods, first, save the following code as safe.php in the root directory of the Web site, and then add an include ("/safe.php") in front of each PHP file:
PHP Anti-Injection code method one:
$value) {if (Eregi ($value, $StrFiltrate)) {return true;}} return false;} Merge $_post and $_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;}} Verify the start of the foreach ($ArrPostAndGet as $key = = $value) {if (Funstringexist ($value, $ArrFiltrate)) {echo ""; if (Emptyempty ($ Strgourl) {echo "";} Else{echo "";} Exit;}}? >
PHP Anti-Injection code method two:
$get _var) {if (Is_numeric ($get _var)) {$get [Strtolower ($get _key)] = Get_int ($get _var);} else {$get [Strtolower ($get _key )] = Get_str ($get _var);}} /* Filter all POST-over variable */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);}} /* Filter function *///integer filter function get_int ($number) {return intval ($number);} String filter functions function Get_str ($string) {if (!GET_MAGIC_QUOTES_GPC ()) {return addslashes ($string);} return $string;}? >
http://www.bkjia.com/PHPjc/752508.html www.bkjia.com true http://www.bkjia.com/PHPjc/752508.html techarticle introduce two methods, first, save the following code as safe.php in the root directory of the Web site, and then add the include ("/safe.php") in front of each PHP file, you can: PHP anti-injection code method one: ...