I need to get the visitor's IP address, but when cron starts, it detects that REMOTE ADDR is an undefined index. Actually there is no remote address when the file works with cron.
How to avoid this problem?
Is there a way in PHP to say "if REMOTE ADDR exists, then think about it, if not (because it works from 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/");
}
source share