DenChu

Untitled

Mar 22nd, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. if ( \IPS\Db::i()->select( 'COUNT(*)', 'core_api_logs', array( 'ip_address=? AND is_bad_key=1', \IPS\Request::i()->ipAddress() ) )->first() > 10 )
  2.             {
  3.                 \IPS\Db::i()->insert( 'core_banfilters', array(
  4.                     'ban_type'      => 'ip',
  5.                     'ban_content'   => \IPS\Request::i()->ipAddress(),
  6.                     'ban_date'      => time(),
  7.                     'ban_reason'    => 'API',
  8.                 ) );
  9.                 unset( \IPS\Data\Store::i()->bannedIpAddresses );
  10.                 throw new \IPS\Api\Exception( 'IP_ADDRESS_BANNED', '1S290/A', 403 );
  11.             }
Advertisement
Add Comment
Please, Sign In to add comment