You are here

function _honeypot_get_interval_from_signed_js_value in Honeypot 7

Returns an interval if the given javascript submitted value is valid.

Parameters

string $honeypot_time: The signed interval as submitted via javascript.

Return value

int|FALSE The interval in seconds if the token is valid, FALSE otherwise.

1 call to _honeypot_get_interval_from_signed_js_value()
_honeypot_time_restriction_validate in ./honeypot.module
Validate honeypot's time restriction field.

File

./honeypot.module, line 376
Honeypot module, for deterring spam bots from completing Drupal forms.

Code

function _honeypot_get_interval_from_signed_js_value($honeypot_time) {
  $t = explode('|', $honeypot_time);
  if (count($t) != 3) {
    return FALSE;
  }
  $js_token = $t[0] . '|' . $t[1];
  $token_check = honeypot_get_time_from_signed_timestamp($js_token);
  if (!$token_check) {
    return FALSE;
  }
  $interval = (int) $t[2];
  if ($interval == 0) {
    return FALSE;
  }
  return $interval;
}