// Here must be also your IP...
$UCWebmaster_ip = "192.168.178.13, 192.168.178.12 , 192.168.178.14, 192.168.178.16"; // string array with spaces, and separated by comma
// use str_replace to remove spaces from string $UCWebmaster_ip
$UCWebmaster_ip = str_replace(' ', '', $UCWebmaster_ip);
// use explode to split strings in $UCWebmaster_ip array by comma
$array = explode(',',$UCWebmaster_ip);
$allowIP = $array;
if (in_array ($_SERVER['REMOTE_ADDR'], $allowIP)) {
echo "your IP is here";
} else {
echo "your IP is NOT here";
}
echo " <br />";
echo var_dump($array);
echo " <br />";
explode — Split a string by string
implode — Join array elements with a string
str_replace — Replace all occurrences of the search string with the replacement string
Previous page: Deprecated: mysql_db_query()
Next page: Mysql