back

PHP Download Counter
Muttsurini
&
Unkn0wn
Desc
Doc
Changes

Documentation


Setup:

This Code is written in PHP so make sure your webserver supports php.
Download the zip and extract it. The code comes with an example, so you can open the example.php and test it.
Important: If the example.php shows a line like Can not read file : /downloads/counter.txt make sure that example.php and download.php have the rights to open and edit counter.txt and that the file exists (can be empty)

Customization:

If the test was successful you can start to edit the download.php.
Firstly choose a directory for the files, and the counter.txt path.
If you have an 404 Error page link $error404page to it, otherwise just link it to your main page
You can use the default settings and just replace the example downloads with your own files.

Next you need to create an entry in the array $arr for every file.
Just edit the two existing files and copy them, it's easiest if you create the new entries on top of the old.
The entries must look like "Number" => "Filename",
where number must not exists twice in the array and Filename is the exact name of your file with ending, also don't forget the comma.

Lastly you need to edit your websites where you want the download link and the download counter to appear.
For the download you just need to create a link to download.php?f=Number where Number is the number you gave the entry of the file in download.php.
For the counter just paste <?php require_once("download.php"); countdownload("Filename");?> (The filename must be with ending)

Metadata:

Programmer:
Muttsurini
Version:
1.1
Release Date:
23.05.2013
Last modified:
25.05.2013
Requirements:
PHP
Downloads:
444
Download