barkster Posted March 22, 2006 Share Posted March 22, 2006 I'm missing something really simple here. I want to restrict a site from ip other than the two listed. If it doesn't match either of the ip addresses I want to redirect. If I just look at one ip it works but when I tell it can equal either it redirects no matter if the ip is correct. I'm missing something with the || here.[code]<?php $domain = GetHostByName($REMOTE_ADDR); //accetable IP addresses 192.168.10.1 or 192.168.10.5if (($domain <> '192.168.10.1') || ($domain <> '192.168.10.5')) { header("Location: Failed.php"); }print($domain);?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/5524-simple-logical-or/ Share on other sites More sharing options...
php_b34st Posted March 22, 2006 Share Posted March 22, 2006 Try:[code]<?php$domain = GetHostByName($REMOTE_ADDR);//accetable IP addresses 192.168.10.1 or 192.168.10.5if (($domain = '192.168.10.1') || ($domain = '192.168.10.5')) { header("Location: Failed.php"); }print($domain);?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/5524-simple-logical-or/#findComment-19725 Share on other sites More sharing options...
barkster Posted March 22, 2006 Author Share Posted March 22, 2006 I finally got it to work with [code]<?php $domain = GetHostByName($REMOTE_ADDR); if (($domain != '67.76.239.169') and ($domain != '206.54.192.64')) { header("Location: Failed.php"); }?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/5524-simple-logical-or/#findComment-19733 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.