Here's the php:
$add = 1; $file = $_GET['file']; $current = fopen('downloads/log/' . $file . '.txt', 'r'); fclose($current); $del = fopen('downloads/log/' . $file . '.txt', 'w'); fclose($del); if($current < 1){ $add = 1;} else{ $add = $current + 1;} $fh = fopen('downloads/log/' . $file . '.txt', 'w') or die("unknown"); fwrite($fh, $add); fclose($fh); $n = fopen('downloads/log/' . $file . '.txt', 'r'); fclose($n);
<b><?php echo $file; ?></b><br> Your download of <?php echo $file; ?> will begin in five seconds. If it does not, click the link below.<br><br> <a href="downloads/<?php echo $file; ?>">Download</a><br> This file has been downloaded <?php echo $n ?> times.For some reason the end result looks like:
In the log itself the number is always 2...test.zip
Your download of test.zip will begin in five seconds. If it does not, click the link below.
Download
This file has been downloaded Resource id #4 times.