You are here

function rate_bots_check_threshold in Rate 7

Check the number of votes between now and $interval seconds ago.

Parameters

string $ip:

int $interval:

Return value

int

1 call to rate_bots_check_threshold()
rate_bots_is_blocked in ./rate.bots.inc
Check if the current user is blocked.

File

./rate.bots.inc, line 116

Code

function rate_bots_check_threshold($ip, $interval) {
  $sql = 'SELECT COUNT(*) FROM {votingapi_vote} WHERE vote_source = :ip AND timestamp > :time';
  return db_query($sql, array(
    ':ip' => $ip,
    ':time' => REQUEST_TIME - $interval,
  ))
    ->fetchField();
}