mapleanton
01-05-2011, 10:56 AM
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 (http://www.google.com)
<?php
$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.google.com' ) ; //www.google.com = Site where it needs to redirected to
?>
:] MapleAnton ~
<?php
$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.google.com' ) ; //www.google.com = Site where it needs to redirected to
?>
:] MapleAnton ~