This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/modules/blocked_ip/blocked_ip.inc.php

51 lines
1.2 KiB
PHP
Raw Normal View History

<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
2009-08-03 04:10:16 +00:00
*
* Originally authored by Tony Landis, AgileBill LLC
*
* Recent modifications by Deon George
*
* @author Deon George <deonATleenooksDOTnet>
* @copyright 2009 Deon George
* @link http://osb.leenooks.net
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
2009-08-03 04:10:16 +00:00
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
2009-08-03 04:10:16 +00:00
* @subpackage Module:BlockedIP
*/
2009-08-03 04:10:16 +00:00
/**
* The main AgileBill Blocked IP Class
*
* @package AgileBill
* @subpackage Module:BlockedIP
*/
class blocked_ip extends OSB_module {
/**
* Is IP Blocked?
*/
public function is_blocked($ip) {
if ($ip && ! preg_match('/\./',$ip))
return true;
$ip_oct = explode('.',$ip);
$db = &DB();
$result = $db->Execute($q=sqlSelect($db,'blocked_ip','id',sprintf('ip IN (::%s::,::%s.%s::,::%s.%s.%s::,::%s::)',
$ip_oct[0],$ip_oct[0],@$ip_oct[1],$ip_oct[0],@$ip_oct[1],@$ip_oct[2],$ip)));
if ($result->RecordCount() > 0)
return true;
return false;
}
}
2009-08-03 04:10:16 +00:00
?>