Simple Contact Form: Please Test!
Permalink
I've thrown together a simple block (attached), largely to teach myself how to do it. It's a contact form that prevents spam by disallowing links (brutal, but 100% effective in my experience).
I'd love for people to test it and maybe even comment on the code.
If it's okay and useful, I'll submit it to the c5 store as a freebie.
Draft documentation:
‘Contact (No Links)’ is a very simple email contact form. Its primary characteristic is that it prevents spam by disallowing the posting of links. It does not support any additional forms of spam prevention; eg, CAPTCHAs or concrete5’s spam detection services.
If there is a legitimate need for clients to send links, either arrange for this to be done in a subsequent email, or use concrete5’s built-in ‘Form’ block.
Unlike concrete5’s ‘Form’ block, ‘Contact (No Links)’ does not retain a copy of the information submitted.
Notes for Developers/Assessors
In addition to HTML-formatted links, ‘Contact (No Links)’ checks for several forms of markdown and BBCode. Checks are conducted client-side (for responsiveness and reduced server load) and server-side (in case a spammer manages to bypass the client-side checks).
The tests used to detect links are not intended to verify that URLs are correctly formed; nor do they check for all possible TLDs. They merely aim to ascertain whether the text contains anything that is probably a link and not just English text. False positives are possible but should not occur in normal use.
The email sent by this block is HTML-formatted via the mail/no_link_contact_form.php template. This can be customised by hand.
Thanks!
I'd love for people to test it and maybe even comment on the code.
If it's okay and useful, I'll submit it to the c5 store as a freebie.
Draft documentation:
‘Contact (No Links)’ is a very simple email contact form. Its primary characteristic is that it prevents spam by disallowing the posting of links. It does not support any additional forms of spam prevention; eg, CAPTCHAs or concrete5’s spam detection services.
If there is a legitimate need for clients to send links, either arrange for this to be done in a subsequent email, or use concrete5’s built-in ‘Form’ block.
Unlike concrete5’s ‘Form’ block, ‘Contact (No Links)’ does not retain a copy of the information submitted.
Notes for Developers/Assessors
In addition to HTML-formatted links, ‘Contact (No Links)’ checks for several forms of markdown and BBCode. Checks are conducted client-side (for responsiveness and reduced server load) and server-side (in case a spammer manages to bypass the client-side checks).
The tests used to detect links are not intended to verify that URLs are correctly formed; nor do they check for all possible TLDs. They merely aim to ascertain whether the text contains anything that is probably a link and not just English text. False positives are possible but should not occur in normal use.
The email sent by this block is HTML-formatted via the mail/no_link_contact_form.php template. This can be customised by hand.
Thanks!