简体   繁体   中英

Building a secure contact form

I'm building a contact form (PHP file, design has been already made) which will communicate with the PHP via AJAX . I need to secure the contact form to deny any spam, for the client side, I'll be using ReCaptcha for the validation on client side ... But, how can I secure the script from being tampered with or sending arbitrary codes?

I mean, if the spammer/hacker uses the form and submits a PHP code that could affect the server, how can I prevent this from happening?

The text that has been entered in your contact form should never be executed, only passed along in an e-mail message. So, whatever a hacker would submit, the worst it should be able to do is show up in the mailbox behind the form.

It's also always a good idea to use htmlentities on the content sent from your contact form, so if any HTML characters are used, they can't do any harm.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM