Online download tracking system.
Un-zip and copy the PHP Download files onto your webserver space (we'll assume it's in /home/www/phpdownload, and the files are in /home/www/files).
Edit the settings.php file in the includes folder.
The important settings are marked in bold:
Application Database Settings | |
$pwDb->username = "phpdownload"; | Database username |
$pwDb->password = "phpdownload"; | Database password |
$pwDb->host = "localhost"; | Database host |
$pwDb->dbname = "phpdownload"; | Database name |
$pwDb->prefix = "PD_"; | Database object prefix |
PHP Download Application Settings | |
$pdFilesFolder = "../files"; | Relative or absolute path to the files |
$pdSitename = "Webster-Smalley Downloads"; | Title of download page |
$pdCreateDummyFiles = 0; | Should the installer create dummy file entries in the database |
$pdCopyrightNotice= "Website and contents copyright (c) 2005-2009 Webster-Smalley"; | Copyright notice for the html pages |
$pdDeliverUrl= "deliverfile.php?filename="; | Deliver URL If you can setup .htaccess (rename sample.htaccess to .htaccess), then set to this "delivery/" and downloads will have their name set "better". |
$pdAdHtml= ""; | Put your google adsense code or equivalent here and it'll render on the pages. |
Once the settings are correctly set, save and update the file in the web space.
Next, create the db objects by running the script admin/PD_Admin_InstallDb.php in a browser.
You should be greeted with signs of success similar to:
DDL: files table DDL: vFiles view DML: Adding File1 to db (if they don't already exist). DML: Adding File2 to db (if they don't already exist).
Rather than hyperlinking directly to files, redirect users to download.php?filename= (appending the filename in question). This shows a page, registers a "hit" and then uses the meta refresh tag to deliver the actual file.
To list files browse to admin/PD_ListFiles.php. This page shows all registered files and their activity (hits). It also allows you to add new files.
To completely uninstall the PHP Download database, run admin/PD_Admin_UninstallDb.php. Note that this process will drop tables from the database and data will be lost!
To preserve the integrity of your new download system, it is recommended that the admin folder be protected against casual access (either by deleting the folder after initial setup, or by configuring your web server to protect the folder).