PHP for URL Insurance filtering processing

Source: Internet
Author: User
Tags php error
PHP for URL Security filtering processing
Preg_match_all ('/([0-9]) = ([\%\+\-\.\/0-9\=a-z\_]+)/I ', $_server[' query_string '], $_get); $_get = ($_get[0]? array_ Combine ($_get[1], $_get[2]): Array ()) + array_fill (0, 10, ");

Now your $_get only accept the 0-9 setting of course these URLs are safe.

? 0=123&1=456 illegal url&2=789 "and Xxx=1&3=0abc&4=base64_code&5=urlencode


An acceptable URL [\%\+\-\.\/0-9\=a-z\_]+

Can understand the put, and has set the non-existent setting to NULL to prevent errors

Usually Isset ($_get[0]) can be changed to $_get[0] no warning message

I've already set the $_get 0-9 nonexistent.

Ah, some people say that direct variables do not have a warning message?? I..

EXPLANATION No warning message does not indicate that no warning message was generated

Set the highest error reporting level in front

Error_reporting (8191);

Do you have a look? And I did a solid and speed test on PHP error messages.

See PHP explaining why to use Isset ()
  • Related Article

    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: 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.