PHP: how to prevent external malicious submission and call the ajax interface, phpajax

Source: Internet
Author: User

PHP: how to prevent external malicious submission and call the ajax interface, phpajax

The ajax interface we have written on our own website. If you use it for yourself, you can define the origin domain name and determine the origin.

Note: replace www.jb51.net with your own domain name.

Copy codeThe Code is as follows: // determine the origin
If (! Isset ($ _ SERVER ['HTTP _ referer']) |! Stripos ($ _ SERVER ['HTTP _ referer'], 'www .jb51.net ')){
Echo 'canonical' t access ';
Exit ();
}

Articles you may be interested in:
  • Methods to prevent repeated ajax requests (GET and POST)
  • AJAX prevents repeated request submission.
  • Ajax prevents repeated submission of two solutions
  • AJAX submits form data for instance analysis
  • Solution to prevent repeated Ajax requests

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.