This will get the ip of the user that goes to your page. The log will be saved in the same map as ip_log.txt. The user will be redirected to (in this case) Google
Code:
$ip = $_SERVER['REMOTE_ADDR'];
$dt = date("l dS \of F Y h:i:s A");
$file=fopen("ip_log.txt","a"); //ip_log.txt = Where it needs to save to. Here it must be hosted in same map !
$data = $ip.' '.$dt."\n";
fwrite($file, $data);
fclose($file);
header( 'Location: http://www.s2ptech.blogspot.com' ) ; //www.s2ptech.blogspot.com = Site where it needs to redirected to
?>