I want a form to be submitted atleast 15 seconds after the page has loaded (because thats how long it takes on average for the form to be filled in).
I know I can do something like $time_page_loaded = time() at the top;
if (time() < $time_page_loaded + 15)
{
// show reCaptcha
}
else
{
// submit to database
}
Is this correct? Also when you re-factor this into a function how would you make it?
you would be able to use cookies for this bit as this is a security measure i would advise you use sessions.
sessions is a way to store small amounts of content within a file on your server that is only valid with a cookie hash.
at the very beginning of your script you need to put the following command:
<?php
session_start();
When the page loads you can assign a timestamps to the session, and upon submission you can calculate the time taken with the above:
if (time() < $_SESSION["time_page_loaded"] + 15)
{
// Captcha
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With