PHP anti-injection

xiaoxiao2021-03-06  69

// The illegal character to be filtered $ arrfiltrate = array ("'", ";"); // After the error, the URL to be jumped, does not fill the default one page $ strgourl = ""; // whether there is a value function FunStringExist ($ StrFiltrate, $ ArrFiltrate) array {foreach ($ ArrFiltrate as $ key => $ value) {if (eregi ($ value, $ StrFiltrate)) {return true;}} return false;}

// $ _POST combined 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) {$ arrotandget [] = $ value;}}

// Verify Start Foreach ($ ARPOSTANDGET AS $ Key => $ VALUE) {if (FunStringexist ($ VALUE, $ ArrFiltrate)) {echo