PHP Tutorial Anti-injection code method to filter all get POST /* Filter all get over variable * * foreach ($_get as $get _key=> $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 variables. 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 function Get_int ($number) { Return Intval ($number); } String filter functions function Get_str ($string) { if (!GET_MAGIC_QUOTES_GPC ()) { Return addslashes ($string); } return $string; }
Here we are to tell friends about the PHP anti-injection Code method filter all get post Oh, because most of them can be injected through the got post method, and of course, files
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.