Forum Moderators: coopster
../links.php?id=link10
links.php is like this:
$time = date("Y-m-d h-i", time());
$ip = $_SERVER['REMOTE_ADDR'];
if ($_GET['id'] == "link10") {$link = "http://www.site10.com";}
if ($_GET['id'] == "link11") {$link = "http://www.site11.com";}
At the bottom of the file we have:
header("Location: $link");
To this $link we can append information like time, IP address, etc. (as shown, $time, $ip)
All works fine.
Now we would like to log each click where we would write information into flat file like csv.
Information that would be written is a click numeric order, time, IP address, and link ID – four columns in total.
If some of php experts is favouring mysql, it’s ok, we can use that as well.
The question is:
What would be the shortest code within existing link.php file that would do this task?
As optional function we could also use click number as a variable that would be appended at the end of outgoing link, something like this:
header("Location: $link+$cn");
where $cn is a click number being constantly increased by value of 1.
Thanks
However my example doesnt have any error handling, so they need a bit of both ;)