flood_is_allowed

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/common.inc, строка 995

Версии
5 – 6
flood_is_allowed($name, $threshold)

Check if the current visitor (hostname/IP) is allowed to proceed with the specified event.

The user is allowed to proceed if he did not trigger the specified event more than $threshold times per hour.

Параметры

$name The name of the event.

$number The maximum number of the specified event per hour (per visitor).

Возвращаемое значение

True if the user did not exceed the hourly threshold. False otherwise.

▾ 2 функции вызывают flood_is_allowed()

contact_site_page in modules/contact/contact.pages.inc
Site-wide contact page.
contact_user_page in modules/contact/contact.pages.inc
Страница персональных контактов.

Код

<?php
function flood_is_allowed($name, $threshold) {
  $number = db_result(db_query("SELECT COUNT(*) FROM {flood} WHERE event = '%s' AND hostname = '%s' AND timestamp > %d", $name, ip_address(), time() - 3600));
  return ($number < $threshold ? TRUE : FALSE);
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему