J jlknauff New member Aug 25, 2008 237 1 0 Nov 4, 2010 #1 Can someone tell me how to add a second IP address to this? PHP: <? $visitor = $_SERVER['REMOTE_ADDR']; if (preg_match("/174.170.197.174/",$visitor)) { } else { header('Location: http://www.domain.com/'); }; ?>
Can someone tell me how to add a second IP address to this? PHP: <? $visitor = $_SERVER['REMOTE_ADDR']; if (preg_match("/174.170.197.174/",$visitor)) { } else { header('Location: http://www.domain.com/'); }; ?>
erect New member Jun 3, 2007 3,796 154 0 Esoterica twitter.com Nov 4, 2010 #2 PHP: <? $visitor = $_SERVER['REMOTE_ADDR']; if ( (preg_match("/174.170.197.174/",$visitor)) || (preg_match("/174.170.197.175/",$visitor)) ) { } else { header('Location: http://www.domain.com/'); }; ?> BTW: I'm a lazy fuck and I ALWAYS write it like this "/174.170.197.174/i" ... the i at the end means case insensitive and it won't make a difference with what you are doing. Just my old habits because I've been burned a few times when scraping.
PHP: <? $visitor = $_SERVER['REMOTE_ADDR']; if ( (preg_match("/174.170.197.174/",$visitor)) || (preg_match("/174.170.197.175/",$visitor)) ) { } else { header('Location: http://www.domain.com/'); }; ?> BTW: I'm a lazy fuck and I ALWAYS write it like this "/174.170.197.174/i" ... the i at the end means case insensitive and it won't make a difference with what you are doing. Just my old habits because I've been burned a few times when scraping.
imkazu geeky marketer Sep 5, 2010 446 3 0 Vancouver, Canada www.imkazu.com Nov 5, 2010 #4 you don't really need to use regex (slower) here, so if you want to optimize a little use this instead: if ($visitor=='174.170.197.174' || $visitor=='174.170.197.175')
you don't really need to use regex (slower) here, so if you want to optimize a little use this instead: if ($visitor=='174.170.197.174' || $visitor=='174.170.197.175')