View Full Version : Stupid variables! HELP! :(
Need some help with this:
<?PHP
$staff_ips[1] = "84.71.128.117";
$staff_ips[2] = "84.71.128.118";
if($staff_ips[1] != $_SERVER['REMOTE_ADDR']){
die("You are not authorised to view this Page.");
else if($staff_ips[2] != $_SERVER['REMOTE_ADDR']){
die("You are not authorised to view this Page.");
}
}
?>
I get this error: Parse error: syntax error, unexpected T_ELSE in /home/habbo06/public_html/security/log_ip.php on line 9
Its probbably a stupid mistake :P
Eric30
05-08-2006, 12:08 PM
<?PHP
$staff_ips[1] = "84.71.128.117";
$staff_ips[2] = "84.71.128.118";
if($staff_ips[1] != $_SERVER['REMOTE_ADDR']){
die("You are not authorised to view this Page.");
}else if($staff_ips[2] != $_SERVER['REMOTE_ADDR']){
die("You are not authorised to view this Page.");
}
?>
altho i dont think that script would work anyway, coz its saying is its not the first one, and not the second one its not authorises. But an IP cant be both
PixelResources
05-08-2006, 12:13 PM
<?php
$staff_ips[1] = "84.71.128.117";
$staff_ips[2] = "84.71.128.118";
if($staff_ips[1] != $_SERVER['REMOTE_ADDR']){
die("You are not authorised to view this Page.");
}else if($staff_ips[2] != $_SERVER['REMOTE_ADDR']){
die("You are not authorised to view this Page.");
}
?>
and yeah, both IP's are blocked.. It will work if your trying to make an IP Ban thing, is that what your doing?
Its to say if a ip isnt the one in $staff_ip[1] or$staff_ip[2] it will block them
PixelResources
05-08-2006, 02:22 PM
Well from what i can see it is saying if the IP is one of them it won't let them see it.
!= means not equal mate :)
PixelResources
05-08-2006, 02:27 PM
Mhmm ok.
Edit: LMAO @ UR SIG.
Eric30
05-08-2006, 11:25 PM
Im still not sure,
lets say my IP was 84.71.128.117
if it is not 84.71.128.117 then its ok
if its not 84.71.128.118 (which it isnt) then 'You are not authorised to view this Page'
See what i mean? That script doesnt seem logicaly right. Please say if it works or not :D
<?PHP
$staff_ips[1] = "84.71.128.117";
$staff_ips[2] = "84.71.128.118";
if($staff_ips[1] != $_SERVER['REMOTE_ADDR']){
die("You are not authorised to view this Page.");
}else if($staff_ips[2] != $_SERVER['REMOTE_ADDR']){
die("You are not authorised to view this Page.");
}
?>
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.