Hi.
I just created a simple method to limit form submission to once per x sec/min/hrs/days/etc. It is done using cookies (so it's not uber spam-proof method). However - my client likes it a lot, so maybe some ppl here will find it useful too.
Pros:
+ simple
+ works with ALL browsers with cookie support
+ doesn't need any php and sql knowledge (just copy and paste codes below)
Cons:
- simple = easy to override
- clearing cookies unlocks form
- form is still here, but it's hidden - you can use i.e.: FireBug to unhide it and send it again
All you need to do is follow those steps:
1. Insert this code as Before Emails Code:
2. Insert all form fields, buttons, etc. into container, give it a class name i.e.: "containerformtest".
3. On top of your form insert custom code:
It's very simple (and fragile - just delete cookies and you can send form again) method, which has some pros and cons, but if it fits your needs - feel free to use it.
Regards. 8)
I just created a simple method to limit form submission to once per x sec/min/hrs/days/etc. It is done using cookies (so it's not uber spam-proof method). However - my client likes it a lot, so maybe some ppl here will find it useful too.
Pros:
+ simple
+ works with ALL browsers with cookie support
+ doesn't need any php and sql knowledge (just copy and paste codes below)
Cons:
- simple = easy to override
- clearing cookies unlocks form
- form is still here, but it's hidden - you can use i.e.: FireBug to unhide it and send it again
All you need to do is follow those steps:
1. Insert this code as Before Emails Code:
<?php
$expire=time()+60*60*24*30; // set cookie expiration time to 60 seconds * 60 minutes * 24 hours * 30 days = 1 MONTH. This notation can look weird, but it makes expire-time setting much easier. Change it for whatever you need, i.e.: 60*15 (15 minutes).
setcookie("formtest", "filled", $expire); // sets cookie. Feel free to insert any name (first position) and variable (2nd position).
?>
2. Insert all form fields, buttons, etc. into container, give it a class name i.e.: "containerformtest".
3. On top of your form insert custom code:
<?php
if (isset($_COOKIE["formtest"])) // check if cookie is set.
echo "<style>.containerformtest{display: none !important;}</style><br/>You've already sent this form."; // hides whole form + adds message
?>
It's very simple (and fragile - just delete cookies and you can send form again) method, which has some pros and cons, but if it fits your needs - feel free to use it.
Regards. 8)