How to prevent external malicious submissions from calling the ajax interface in PHP, phpajax
We have written the ajax interface for our own website. If it is used for ourselves, then limit the source domain name and judge Just hit the road.
Note: Replace www.jb51.net with your own domain name.
Copy the codeThe code is as follows: //Judge the source
if(!isset($_SERVER['HTTP_REFERER']) || !stripos($_SERVER['HTTP_REFERER'],'www.jb51.net')) {
echo 'cann`t access';
exit();
}
Articles you may be interested in:
- Methods to prevent repeated ajax requests (GET and POST)
- AJAX implementation plan to prevent users from repeatedly submitting requests
- ajax 2 solutions to prevent users from repeatedly submitting
- AJAX submission form data instance analysis
- Solutions to prevent repeated Ajax requests
http://www.bkjia.com/PHPjc/1119974.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1119974.htmlTechArticleHow to prevent external malicious submissions from calling the ajax interface, phpajax in PHP. The ajax interface written by our own website, if we give it to ourselves If you use it, then just limit the source domain name and determine the source. ...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn