Ipaddress_Controller
in package
IP addresses.
Tags
Table of Contents
Properties
- $instance : mixed
- The singleton instances.
- $_cacheName : string
- Cache name
- $_DenyAccessIpaddresses : array<string|int, mixed>|null
- Cache for getDenyAccessIpaddresses()
- $_NoStatisticIpaddresses : array<string|int, mixed>|null
- Cache for getNoStatisticIpaddresses()
Methods
- clearCache() : self
- Clear ipaddresses cache
- getDenyAccessIpaddresses() : array<string|int, mixed>
- Get Deny Access Ipaddresses
- getNoStatisticIpaddresses() : array<string|int, mixed>
- Get No Statistic Ipaddresses
- incIpaddressBanned() : mixed
- Update banned fo Ipaddress
- instance() : object
- Register an existing instance as a singleton.
- ipCheck() : bool
- Check IP in CIDR
- isBackendBlocked() : bool
- Check is IP blocked in Backend
- isBlocked() : bool
- Check is IP blocked in Frontend
- isNoStatistic() : bool
- Check Ignore IP in statistics
Properties
$instance
The singleton instances.
public
static mixed
$instance
= \NULL
$_cacheName
Cache name
protected
string
$_cacheName
= 'ipaddresses'
$_DenyAccessIpaddresses
Cache for getDenyAccessIpaddresses()
protected
array<string|int, mixed>|null
$_DenyAccessIpaddresses
= \NULL
$_NoStatisticIpaddresses
Cache for getNoStatisticIpaddresses()
protected
array<string|int, mixed>|null
$_NoStatisticIpaddresses
= \NULL
Methods
clearCache()
Clear ipaddresses cache
public
clearCache() : self
Return values
selfgetDenyAccessIpaddresses()
Get Deny Access Ipaddresses
public
getDenyAccessIpaddresses() : array<string|int, mixed>
Return values
array<string|int, mixed>getNoStatisticIpaddresses()
Get No Statistic Ipaddresses
public
getNoStatisticIpaddresses() : array<string|int, mixed>
Return values
array<string|int, mixed>incIpaddressBanned()
Update banned fo Ipaddress
public
incIpaddressBanned(int $id) : mixed
Parameters
- $id : int
instance()
Register an existing instance as a singleton.
public
static instance() : object
Return values
objectipCheck()
Check IP in CIDR
public
ipCheck(string $ip, string $cidr) : bool
Parameters
- $ip : string
-
IP
- $cidr : string
-
CIDR (Classless Inter-Domain Routing)
// IPv4 $oIp_Controller = new Ipaddress_Controller(); var_dump($oIp_Controller->ipCheck('86.111.222.10', '86.111.222.0/24'));
// IPv6 $oIp_Controller = new Ipaddress_Controller(); var_dump($oIp_Controller->ipCheck('02aa:5680:ffff:ffff:ffff:ffff:ffff:ffff', '2aa:5680::/32'));
Return values
boolisBackendBlocked()
Check is IP blocked in Backend
public
isBackendBlocked(mixed $aIp[, bool $incBanned = TRUE ]) : bool
Parameters
- $aIp : mixed
-
array of IPs or IP
- $incBanned : bool = TRUE
-
Increase blocked counter
Return values
boolisBlocked()
Check is IP blocked in Frontend
public
isBlocked(mixed $aIp[, bool $incBanned = TRUE ]) : bool
Parameters
- $aIp : mixed
- $incBanned : bool = TRUE
-
Increase blocked counter
Return values
boolisNoStatistic()
Check Ignore IP in statistics
public
isNoStatistic(mixed $aIp) : bool
Parameters
- $aIp : mixed
-
array of IPs or IP