یک فایل php ( برای نمونه download.php) بساز و کد html را داخل اون قرار بده با توجه به نمونه کد زیر:
<?php
$Down=$_GET['Down'];
?>
<html>
<head>
<meta http-equiv="refresh" content="0;url=<?php echo $Down; ?>">
</head>
<body>
<?php
$filePath = $Down.".txt";
// If file exists, read current count from it, otherwise, initialize it to 0
$count = file_exists($filePath) ? file_get_contents($filePath) : 0;
// Increment the count and overwrite the file, writing the new value
file_put_contents($filePath, ++$count);
// Display current download count
echo "Downloads:" . $count;
?>
</body>
</html>
از کد استفاده کن:
download.php?Down=download.zip
یا می تونی از اسکریپت زیر استفاده کنید:
http://tutorialzine.com/2010/02/php-mysql-download-counter/