Code: Select all
function ban($address) {
$ban = array(
0 => '255.255.255.255',
1 => '250.250.250'
);
for ($i = 0; $i < sizeof($ban); $i++) {
if (eregi('^'.$ban[$i], $address)) {
return true; break;
}
}
}
Code: Select all
function search_array($search, $array, $type) {
switch ($type) {
case (1): // Wildcard at both ends of the string
$one = '';
$two = '';
break;
case (2): // Wildcard at the end of the string
$one = '^';
$two = '';
break;
case (3): // Wildcard at the start of the string
$one = '';
$two = '$';
break;
default: // No wildcard (if wrong type specified)
$one = '^';
$two = '$';
break;
}
for ($i = 0; $i < sizeof($array); $i++) {
if (eregi($one.$search.$two, $array[$i])) {
return true; break;
}
}
}