JavaScript-How does the Foreign Trade website block the mainland IP?

Source: Internet
Author: User
Foreign trade station do not want to let China visit, want to use JavaScript to detect browser language is the Chinese are blocked, but will be hurt to a lot of overseas Chinese, and from the statistics on the website overseas Chinese accounted for a lot, with the back-end PHP to determine whether for the mainland to find a half-day and no clue, this should be how to solve?

Reply content:

Foreign trade station do not want to let China visit, want to use JavaScript to detect browser language is the Chinese are blocked, but will be hurt to a lot of overseas Chinese, and from the statistics on the website overseas Chinese accounted for a lot, with the back-end PHP to determine whether for the mainland to find a half-day and no clue, this should be how to solve?

Simply want to block the IP words, need to find the Chinese mainland IP. While the APAC IP is owned by apnic, you can download: http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest

Then, according to the country code "CN" to find the Chinese mainland IP.

The specific can be executed in the shell:

wget http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latestgrep ipv4 delegated-apnic-latest | grep CN | awk -F'|' '{print $4}'

The output is the IP of mainland China.

I have to turn over the wall how do you block ...

PS: Don't want them to see a little bit less realistic, can not let them buy. such as ban off registered mailbox, mobile phone number, mailing address and so on

Look at IP access, if it is a domestic IP shield

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