How PHP avoids the data submitted by the form is safe

Source: Internet
Author: User
Tags ticket
How PHP handles the data submitted by the form is safe
What needs to be done with user-submitted form data to prevent js,sql injection, prevent duplicate commits and commit illegally
What to do to filter out the submitted illegal data, hope to have a complete code, thank you.

------Solution--------------------
This reads "PHP and MySQL Web development" can be mastered by the system.

JS anti-injection: Htmlspecialchars
SQL anti-injection: mysql_real_escape,addslashes
Filter illegal data: Must own coding the check rule, you want how to examine to write the code yourself, with regular, with Trim,isset,empty, and so on.
Prevent illegal submissions: their own coding, the order is isset,trim,empty, other checks, roughly this order.
Repeat commit: Generate a unique ticket in the session and add ticket to the hidden of the form, and the validation is consistent after the form is submitted.
  • 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.