Php is safe to avoid data submitted by forms.

Source: Internet
Author: User
Tags php and mysql sql injection prevention
How php processes the data submitted by forms is safe. What processing is required for the form data submitted by users to prevent js and SQL injection, prevent repeated submission and illegal submission to filter out the submitted illegal data. please have the complete code. thank you. ------ Solution ------------------ read "PHP and MYSQLWEB development" to get the system started. JS anti-injection: htmlspecialcharsSQL prevents php from handling data submitted by forms.
What processing is required for the form data submitted by the user to prevent js and SQL injection and prevent repeated and illegal submission?
How can I filter out the submitted illegal data? I hope the complete code is available. thank you.

------ Solution --------------------
Read "PHP and mysql web development" and you will be able to master the system.

JS anti-injection: htmlspecialchars
SQL Injection Prevention: mysql_real_escape, addslashes
Illegal data filtering: you must check your own coding rules. if you want to check the rules, write your own code, use regular expressions, trim, isset, empty, and so on.
Prevent unauthorized submission: self-built coding. The order is isset, trim, empty, and other verifications.
Repeated submission: generate a unique ticket in the SESSION, add the ticket to the hidden of the form, submit the form, and verify that it is consistent.

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.