|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
|
|||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
If code not working?
To all,
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["REMTE_ADDR"]=="x.x.x.x")|| ($_SERVER["REMTE_ADDR"]=="y.y.y.y")|| 0 ){ header("Location: /access_disabled.php"); exit(); } ?> Chris -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
#2
|
|||
|
|||
|
If code not working?
Christopher Malton wrote:
To all, 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["REMTE_ADDR"]=="x.x.x.x")|| ($_SERVER["REMTE_ADDR"]=="y.y.y.y")|| 0 ){ header("Location: /access_disabled.php"); exit(); } ?> Chris Ehm It should work. I've rewritten it a tad: <?php if($_SERVER["REMTE_ADDR"]=="x.x.x.x" || $_SERVER["REMTE_ADDR"]=="y.y.y.y" || 0) { header("Location: /access_disabled.php"); exit(); } ?> -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
#3
|
|||
|
|||
|
If code not working?
I agree with the points about the futility of having a 0 there, however,
it won't have any impact on how it works :) why? just follow the logic: if the ip equals x.x.x.x: access_disabled R if the ip equals y.y.y.y: access_disabled R if FALSE: (never happens) so, what you get is that on true from #1 or #2 it shows access_disabled, on anything else, it skips the if. So, in this case it doesn't matter though it's still sloppy. -tul Paul Menard wrote: Um. What is the '0' for? if( ($_SERVER["REMTE_ADDR"]=="x.x.x.x")|| ($_SERVER["REMTE_ADDR"]=="y.y.y.y")|| 0 <-- This should not be here. ) Message From: Christopher Malton <admin (AT) cjsoftuk (DOT) dyndns.org> To: php-windows (AT) lists (DOT) php.net Sent: Wednesday, January 04, 2006 13:00:24 Subject: [PHP-WIN] If code not working? To all, 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["REMTE_ADDR"]=="x.x.x.x")|| ($_SERVER["REMTE_ADDR"]=="y.y.y.y")|| 0 ){ header("Location: /access_disabled.php"); exit(); } ?> Chris -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
#4
|
|||
|
|||
|
If code not working?
I agree with the points about the futility of having a 0 there, however,
it won't have any impact on how it works :) why? just follow the logic: if the ip equals x.x.x.x: access_disabled R if the ip equals y.y.y.y: access_disabled R if FALSE: (never happens) so, what you get is that on true from #1 or #2 it shows access_disabled, on anything else, it skips the if. So, in this case it doesn't matter though it's still sloppy. -tul Paul Menard wrote: Um. What is the '0' for? if( ($_SERVER["REMTE_ADDR"]=="x.x.x.x")|| ($_SERVER["REMTE_ADDR"]=="y.y.y.y")|| 0 <-- This should not be here. ) Message From: Christopher Malton <admin (AT) cjsoftuk (DOT) dyndns.org> To: php-windows (AT) lists (DOT) php.net Sent: Wednesday, January 04, 2006 13:00:24 Subject: [PHP-WIN] If code not working? To all, 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["REMTE_ADDR"]=="x.x.x.x")|| ($_SERVER["REMTE_ADDR"]=="y.y.y.y")|| 0 ){ header("Location: /access_disabled.php"); exit(); } ?> Chris -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
![]() |
| Viewing: Web Development Archives > Mailing Lists > PHP - Windows > If code not working? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|