I need to get the IP of the visitor, but when the cron runs it finds that REMOTE ADDR is an undefined index. In fact there is no remote address when the file runs with the cron.
How do I avoid this issue?
Is there a way in PHP to say " if REMOTE ADDR exists then consider it, if not ( because it is running from the cron ) then bypass it" ??
$ip=$_SERVER['REMOTE_ADDR'];
$allowed_ips = array("82.61.144.100", "82.64.144.100");
if (!in_array($ip, $allowed_ips)) {
header("Location: http://pitchmystuff.co.uk/coming_soon/");
}