I have a trap to prevent unwanted surfers getting to the script: if(getenv(REMOTE_ADDR) != $vars["admin ip"]) { Go away} I need for two ips to be able to use the script. Either $vars["admin ip"] OR $vars["admin ip2"] I have tried: if(getenv(REMOTE_ADDR) != $vars["admin ip"] || $vars["admin ip2"]) { Go away} but it doesn't work. Can anyone tell me how this should be coded ??? Thanks John C
if(getenv('REMOTE_ADDR') != $vars["admin ip"] || getenv('REMOTE_ADDR') != $vars["admin ip2"]) { Go away} PHP: Or if (!in_array(getenv('REMOTE_ADDR'), array($vars['admin ip'], $vars['admin ip2']))) { go away } PHP:
Personally, I'd suggest Nico's second option. Create an array for the admin IPs then use in_array to test. You may only have two now but doing it this way makes it easy to expand as far as you want to go - 2 or 200 admins. $admins=array('address1','address2',...); if(!in_array(getenv('REMOTE_ADDR'),$admins)) { go away } PHP: Jon
Hi nico_swd Many thanks for your very quick reply. I found that the first option didn't work but the second option, as recommended by Cobnut did exactly what I wanted. Very many thanks to both of you. John C