[Reprinted] Php anti-injection code provided by 360-PHP source code

Source: Internet
Author: User
[Reprinted] Php anti-injection code provided by 360 [Reprinted] 360 Provided Php anti-injection code

 Error number:[$ Errno], error on line $ errline in $ errfile
"; Die () ;}set_error_handler (" customError ", E_ERROR); $ getfilter =" '| (and | or) \ B. +? (>|<|=| In | like) |\/\\ *. +? \ * \/| <\ S * script \ B | \ bEXEC \ B | UNION. +? Select | Update. +? SET | Insert \ s + INTO. +? VALUES | (Select | Delete). +? FROM | (Create | Alter | Drop | TRUNCATE) \ s + (TABLE | DATABASE) "; $ postfilter =" \ B (and | or) \ B. {1, 6 }? (=|>|<|\\ Bin \ B |\\ blike \ B) |\\/ \\ *. +? \ * \/| <\ S * script \ B | \ bEXEC \ B | UNION. +? Select | Update. +? SET | Insert \ s + INTO. +? VALUES | (Select | Delete). +? FROM | (Create | Alter | Drop | TRUNCATE) \ s + (TABLE | DATABASE) "; $ cookiefilter =" \ B (and | or) \ B. {1, 6 }? (=|>|<|\\ Bin \ B |\\ blike \ B) |\\/ \\ *. +? \ * \/| <\ S * script \ B | \ bEXEC \ B | UNION. +? Select | Update. +? SET | Insert \ s + INTO. +? VALUES | (Select | Delete). +? FROM | (Create | Alter | Drop | TRUNCATE) \ s + (TABLE | DATABASE) "; function StopAttack ($ StrFiltKey, $ StrFiltValue, $ ArrFiltReq) {if (is_array ($ StrFiltValue) {$ StrFiltValue = implode ($ StrFiltValue);} if (preg_match ("/". $ ArrFiltReq. "/is", $ StrFiltValue) = 1) {// slog ("

Operation IP address: ". $ _ SERVER [" REMOTE_ADDR "]."
Operation Time: ". strftime (" % Y-% m-% d % H: % M: % S ")."
Operation page: ". $ _ SERVER [" PHP_SELF "]."
Submission method: ". $ _ SERVER [" REQUEST_METHOD "]."
Parameter submitted: ". $ StrFiltKey ."
Submit data: ". $ StrFiltValue); print" 360 websec notice: Illegal operation! "; Exit () ;}// $ ArrPGC = array_merge ($ _ GET, $ _ POST, $ _ COOKIE ); foreach ($ _ GET as $ key = >$ value) {StopAttack ($ key, $ value, $ getfilter);} foreach ($ _ POST as $ key => $ value) {StopAttack ($ key, $ value, $ postfilter);} foreach ($ _ COOKIE as $ key => $ value) {StopAttack ($ key, $ value, $ cookiefilter);}/* if (file_exists ('update360. php ') {echo "please rename the file update360.php to prevent hackers from using
"; Die ();} */function slog ($ logs) {$ toppath = $ _ SERVER [" DOCUMENT_ROOT "]. "/log.htm"; $ Ts = fopen ($ toppath, "a +"); fputs ($ Ts, $ logs. "\ r \ n"); fclose ($ Ts );}


The above is the content of Php anti-injection code provided in [Reprinted] 360. For more information, see PHP Chinese network (www.php1.cn )!

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.