Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Form submission timer

Featured Replies

A while back someone posted a script that checked how quickly a form was submitted.

 

I thought I'd saved it in a safe place but obviously didn't as I can't find it.

 

Anyone remember who it was and where they posted the code?

It's this function ...

<?php
function spawnSecure($var) { 
	$spawn = trim(stripslashes($var)); $now = date('Y-m-d H:i:s'); $diff = strtotime($now) - strtotime($spawn);
	if($diff<=1.5) { return false; } else { return true; }
}
?>

... the difference here is 1.5 seconds, but this can be adjusted to your needs. All you need to do is add a form field ...

<input type="hidden" name="anything" value="<?php echo date('Y-m-d H:i:s'); ?>">

... then grab it when posted and check if it was too quick ...

<?php
if(!spawnSecure($_POST['anything'])) {
    $err_msg = "<b>Error!</b> - This appears to be an automated attempt, please take your time or call for assistance.";
}

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.