function rate_limit_admin_page() { if (!rate_limit_table_exists()) { return '

La tabella rate_limit non esiste.

'; } $header = array( array('data' => t('IP')), array('data' => t('Richieste recenti')), array('data' => t('Bannato fino')), ); $rows = array(); $result = db_query("SELECT * FROM {rate_limit}"); foreach ($result as $record) { $requests = @unserialize($record->requests); if (!is_array($requests)) { $requests = array(); } $window = 60; $requests = array_filter($requests, function($ts) use ($window) { return ($ts > REQUEST_TIME - $window); }); $ban_until_text = '-'; if ($record->banned_until > REQUEST_TIME) { $ban_until_text = format_date($record->banned_until, 'short'); } $rows[] = array( check_plain($record->ip), count($requests), $ban_until_text, ); } // 🔥 Ordina per richieste recenti (colonna 1) usort($rows, function($a, $b) { return $b[1] - $a[1]; }); return theme('table', array('header' => $header, 'rows' => $rows)); } norma | PAeSI - Pubblica Amministrazione e Stranieri Immigrati
Regione Toscana
norma