Function __global->ip_banned
Definitions
sources/global3.php
- Check to see if an IP address is banned.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: bool
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $ip | string | No | No | required parameter | N/A | N/A | The IP address to check for banning |
| $force_db | boolean | No | No | False | N/A | N/A | Force check via database only |
| $handle_uncertainties | boolean | No | No | False | N/A | N/A | Handle uncertainties (used for the external bans - if true, we may return null, showing we need to do an external check). Only works with $force_db. |
| &$is_unbannable | ?boolean | Yes | No | Null | N/A | N/A | Whether the IP is unbannable by spam standards; on an exclusion list or has a negative ban (returned by reference) (null: not set yet by caller) |
| &$ban_until | ?integer | Yes | No | Null | N/A | N/A | When the ban will expire, will always be more than the current timestamp (null: not set yet by caller / no expiration) |
| $check_caching | boolean | No | No | True | N/A | N/A | Whether to check internal run-time caching (disable if doing automated tests) |
Returns
- Whether the IP address is banned (null: unknown)
- Type: ?boolean
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Check to see if an IP address is banned.
*
* @param string $ip The IP address to check for banning
* @param boolean $force_db Force check via database only
* @param boolean $handle_uncertainties Handle uncertainties (used for the external bans - if true, we may return null, showing we need to do an external check). Only works with $force_db.
* @param ?boolean $is_unbannable Whether the IP is unbannable by spam standards; on an exclusion list or has a negative ban (returned by reference) (null: not set yet by caller)
* @param ?integer $ban_until When the ban will expire, will always be more than the current timestamp (null: not set yet by caller / no expiration)
* @param boolean $check_caching Whether to check internal run-time caching (disable if doing automated tests)
* @return ?boolean Whether the IP address is banned (null: unknown)
*/
function ip_banned(string $ip, bool $force_db = false, bool $handle_uncertainties = false, ?bool &$is_unbannable = null, ?int &$ban_until = null, bool $check_caching = true) : ?bool
* Check to see if an IP address is banned.
*
* @param string $ip The IP address to check for banning
* @param boolean $force_db Force check via database only
* @param boolean $handle_uncertainties Handle uncertainties (used for the external bans - if true, we may return null, showing we need to do an external check). Only works with $force_db.
* @param ?boolean $is_unbannable Whether the IP is unbannable by spam standards; on an exclusion list or has a negative ban (returned by reference) (null: not set yet by caller)
* @param ?integer $ban_until When the ban will expire, will always be more than the current timestamp (null: not set yet by caller / no expiration)
* @param boolean $check_caching Whether to check internal run-time caching (disable if doing automated tests)
* @return ?boolean Whether the IP address is banned (null: unknown)
*/
function ip_banned(string $ip, bool $force_db = false, bool $handle_uncertainties = false, ?bool &$is_unbannable = null, ?int &$ban_until = null, bool $check_caching = true) : ?bool

