RE: [PHP-WIN] If code not working?
| From: | Jay Blanchard | Date: | Wed, 04 Jan 2006 18:24:48 +0000 |
| Subject: | RE: [PHP-WIN] If code not working? | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-26610@lists.php.net to get a copy of this message | ||
[snip]
I appear to have a problem with my If statement. No error is
presented to me, but does anyone see what is wrong. IP addresses masked
for safety & security.
Code as follows:
<?php
if(($_SERVER["REMOTE_ADDR"]=="x.x.x.x")||($_SERVER["REMOTE_ADDR"]=="y.y.y.y"
)||0){
header("Location: /access_disabled.php");
exit();
}
?>
[/snip]
echo $_SERVER["REMOTE_ADDR"] and see what is there. I would also add
parentheses to the statement, surrounding only the IP tests;
if((($_SERVER["REMOTE_ADDR"]=="x.x.x.x")||($_SERVER["REMOTE_ADDR"]=="y.y.y.y
"))||0){
saying "if (remote address OR remore address) OR false