Username: Posted September 21, 2010 Share Posted September 21, 2010 Is this right? $admin = array('24.68.200.235','24.68.214.97'); $visitor_ip = $_SERVER['REMOTE_ADDR']; if($visitor_ip == $admin) { echo "k"; } else { die("dead"); Link to comment https://forums.phpfreaks.com/topic/214011-variable-array/ Share on other sites More sharing options...
the182guy Posted September 21, 2010 Share Posted September 21, 2010 No it has a syntax error, you're missing a } at the end. If you meant, is it the right way to check the visitor IP against a list, then use in_array like this if(in_array($visitor_ip, $admin)) { // visitor is an admin Link to comment https://forums.phpfreaks.com/topic/214011-variable-array/#findComment-1113712 Share on other sites More sharing options...
Username: Posted September 21, 2010 Author Share Posted September 21, 2010 No it has a syntax error, you're missing a } at the end. I know that lol, I just C + Ped it and missed a bracket, but I want it to check for either of those IPs but it only checks the first one, what do I do? EDIT: Thanks! Link to comment https://forums.phpfreaks.com/topic/214011-variable-array/#findComment-1113714 Share on other sites More sharing options...
the182guy Posted September 21, 2010 Share Posted September 21, 2010 No it has a syntax error, you're missing a } at the end. I know that lol, I just C + Ped it and missed a bracket, but I want it to check for either of those IPs but it only checks the first one, what do I do? See my edit. Link to comment https://forums.phpfreaks.com/topic/214011-variable-array/#findComment-1113715 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.