PHP restricted pages can only be accessed in the micro-mail from the browser code

Source: Internet
Author: User

We all want to limit the program can only browse in the micro-letter, the following is the PHP restricted page only in the micro-mail browser access code, we can refer to the

In order to prevent their hard-earned webapp by people copy, we all want to limit the program can only be in the micro-letter inside browsing, although the following implementation of this function, single is a vegetable, no technical content, understand the forgery of the code is broken.    The following is the code that the PHP restricted page can access only in the micro-mail browser.  Code as follows: <!--? php <br?--> $useragent = $_server[' http_user_agent '];  if (Strpos ($useragent, ' micromessenger ') = False) {echo "Non-micro browser prohibit access";  else {echo "micro-browser allow access"; The above code is not perfect, Windows phone's micro-letter can not be used, and then modified: The code is as follows: <!--? php <br?--> $useragent = addslashes ($_server[' Http_use  R_agent ']); if (Strpos ($useragent, ' micromessenger ') = = False && Strpos ($useragent, ' Windows Phone ') = = False) {echo "non-micro-letter  Browser prohibit access to ";  }else{echo "Micro-letter browser allows access to";    You can judge by getting Http_user_agen.  But you think the above method can prevent others to steal your interface, you are wrong, as long as the forgery of http_user_agen or can be normal access. In Google's browser to install a user-agent switcher, or can be casual access. So I also think of using JS to determine whether the mobile phone access, but as long as the browser does not run JS, or can be normal access. But maybe it's hard to get some beginners.
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.