Hi all i’m very new to PHP, what i’m attempting to do is check item number 1 of list one against item number 1 of list 2, then item number 2 of list 1 against item number 2 of list 2…etc, below is the code that i have but it’s causing me some errors, i don’t need to check each item of one list against all the items of another, i simply need to check the item in position x against the item in position x on the other list. It’s for redirecting IP’s to my forums that fall within a range, so my lists may look like:
List1:
127.0.0.0
135.1.1.0
…etc
List2:
127.0.0.20
150.2.0.15
So my only compares would be to see if the REMOTE_ADDR falls in the range of item 1 list 1 - item 1 list 2 or item 2 list 1 - item 2 list 2.
Am i making sense?, hope you can help
[php]function bip_redirect($to, $code = ‘301 Permanently Moved’) {
header(“HxxP/1.1 “.$code);
header(“Location: hxxp://$to”);
exit();
}
if ($vbulletin->options[‘banip_range_block_active’])
{
$blk_ip = strtoupper($_SERVER[‘REMOTE_ADDR’]);
$ipstrt = explode(”\r\n”, $vbulletin->options[‘banip_block_start’]);
$ipend = explode("\r\n", $vbulletin->options[‘banip_range_end’]);
$n = sizeof($ipstrt);
$ne = sizeof($ipend);
for ($i=0;$i<$n;$i++;$ia=0;$ia<$ne;$ia++) {
if (stristr($blk_ip >= $ipstrt[$i] && $blk_ip <=$ipend[$ia]))
{
echo “($vbulletin->options[‘banip_message’])”;
bip_redirect($vbulletin->options[‘banip_redirect’]);
}
}
}
[/php]