**
How To Create a PHP function to handle the download requests, and increment the counter inside the function.
**
For example, create download.php and pass the requested file as a GET parameter:
file_counter_inc(); // <-- The increment happens here
$file_url = $_GET['file_url'];
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"MyFile\"");
readfile($file_url);
Then you output the download link like this:
<a href="download.php?file_url=downloads/<?php echo $website->temp_link ?>"> Download </a>
I need a clear example of this process. Thanks.