# Preventing resubmission of form using timestamp

I am working on a method to prevent users from resubmitting a PHP form and I thought of many methods, but this one seemed to be the most reliable in my tests. I did not want to create redirects for development purposes, and transferring data around.

I create a hidden input with the form holding the time() of which the page loads. Then when the form is submitted I check for the time_stamp + int < time().

This is what it looks like in practice:

$unix =$_POST['unix_timeStamp'];
if($unix + 1800 > time()) { echo "You too long friend <br>"; echo 'start time: '.$unix . ' <br>';
echo 'end time: '. time();
exit;
}


It works fine, after 1800 seconds (30 minutes) the form will simply indicate that the time has expired and they have to start again.

I am just wondering if this is a fool-proof system. Not security wise, but just to prevent double-submits or users taking too long.