Two simple PHP anti-SQL injection codes. Two methods are introduced. first, save the following code as safe. put php in the root directory of the website, and add include (safe. php); you can: php anti-injection code Method 1: introduce two methods. first, save the following code as safe. put php in the root directory of the website, and add include ("/safe. php "); you can:
Php anti-injection code Method 1:
$ 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 ;}/// start foreach verification ($ ArrPostAndGet as $ key =>$ value) {if (FunStringExist ($ value, $ ArrFiltrate )) {echo"