checkBan (function)

Last updated: Fri, Apr 14, 2023 3:59 pm
Return to Knowledgebase

Purpose

Checks to see if an IP address is banned from accessing your site

Location

users/helpers/us_helpers.php

Parameters

# Parameter Data Type Required Description
1 $ip string Yes The IP address you wish to check

Returns

Data Type Description of Returned Data
bool Returns whether or not an IP is banned

Further Documentation:


$isBanned = checkBan("127.0.0.1");
if ($isBanned) {
echo "Access denied. IP address is banned.";
} else {
echo "Access granted. IP address is not banned.";
}


In this example, the checkBan function is used to check if the IP address 127.0.0.1 is banned. If the IP address is banned, the script will output "Access denied. IP address is banned.". If the IP address is not banned, the script will output "Access granted. IP address is not banned.".