Download Tracking Question
Posted: Sat Jul 26, 2003 1:37 pm
Ok, I have the following script in place on my site:
What I am wondering is if there is a way to verify that the file has been downloaded before I add the information to the database. Currently it does it when the download dialogue comes up. So, this creates spam clicking and inflated download counts. Any help on how to get a "true" count of downloads of specific files? Thanks!
Code: Select all
<?php
include ("../includes/connect.php");
if(!empty($file)){
$ref = $_SERVER["HTTP_REFERER"];
$agent = $_SERVER["HTTP_USER_AGENT"];
$remote = $_SERVER["REMOTE_ADDR"];
$date = time();
$query = "INSERT INTO file_tracker (file, RemoteAddr, agent, ref, date) VALUES ('$file', '$remote','$agent','$ref', '$date')";
$result = mysql_query($query) or die (mysql_error());
header("Location:$file");
}
?>