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 Www.buyerinfo.biz "; }else{echo "Micro-letter browser allows access to www.buyerinfo.biz"; 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.