/ release

LinkLogic

LinkLogic is a secure download system that gives you total control over your digital content.

Please be aware that this system was developed some time ago (several years ago in fact) and is now obsolete and discontinued. However a new LinkLogic system is may one day be released with many new and exciting features but until then, this remains mearly as a proof of concept.

Requirements
  • MySQL (5.0+)
  • PHP (5.0+)
Preperation

First of all you need to create a database for your downloads, sounds like it could be hard but i promise its actually quite easy so here we go...

Once you have signed into your control panel for your website (make sure its yours), click "MySQL® Databases". You will now be presented with a screen where you can manage your databases, at the top of the screen their is a section called "Create New Database", in the field give your database a name for example downloads and click "Create Database".

Your database should now be created and listed in the table a little futher down the screen. Now you need a account to sign into your database that you just created. If you already have one you can skip this sectionif you like. Fill out a username and password and click "Create User" but make sure you remember your details as you will need them later.

All that's left to do is to give your account permission to access the database you created and you are ready to move on. To do this scroll down a little more and you will notice a section named "Add User To Database", select your username and database from the dropdown lists and once you are ready click "Add", next check "ALL PRIVILEGES" and click "Make Changes" and you will be glad to know the preperation is now finished for installing LinkLogic.

Configuration

This is the easiest part, open linklogic.php and you should see the following...

$hostname = "";
$username = "";
$password = "";
$database = "";

Now you need to add your login details to connect to your database, dont worry this isnt viewable by anyone else but you. The hostname is usually "localhost", the "username" and "password" are used to connect to the database you created and the "database" is the name of the database you created.

Please note the username and database fields often have a prefix which is often the username you use to login to your control panel so those fields would be "username_admin" and "username_downloads" rather than "admin" and "downloads".

Once you have done that, save the file and rename it if you like.

Uploading

Next you need to upload all of the files inside the "source" folder, i would recommend a tool called cyberduck for this and that can be downloaded from the following website...

http://www.cyberduck.ch

Once you have configured and connected to your FTP, upload linklogic.php and "token.php" to base of your website and your ready to rock and roll.

Database

Now you need to install the LinkLogic database, this is a file named linklogic.sql which lives in the source folder.

On the homepage of your control panel for your website, click "phpMyAdmin", this is the control panel for all of your databases for your website including LinkLogic, you should now have a new tab open and you will notice your database listed to the right of the screen, Click on it. Next you should see a series of options at the top of your tables page, click "Import" and then click browse, find the file linklogic.sql file and make sure the "Character set of the file" is set to "x-user-defined" and click "Go". The LinkLogic database is now uploaded and ready for you to use.

Yay, now your copy of LinkLogic is confugured and tweaked to work with your website, its time to add some downloads to get you started.

At the moment LinkLogic doesnt come with a backend/API so adding downloads is a little more difficult but if you read these instructions carefully, it should be easier than writing this documentation. First of all you need to login to your control panel for your website if you are not already logged in then you need to go back to "phpMyAdmin". Next click on the database you created earlier. LinkLogic currently has several tables, here is a breif outlook on what they do...

linklogic_blacklist
linklogic_clients
linklogic_logging
linklogic_referals
linklogic_tokens
  • linklogic_blacklist - holds information about IP addresses and clients that you have banned from accessing your downloads.
  • linklogic_clients - holds information on clients you have created to access your downloads, you can also set quotas for them so they can't download too many files.
  • linklogic_logging - holds information about files that people have downloaded, including how many times a file has been downloaded, when it was last downloaded and the names of the files that have been downloaded.
  • linklogic_referals - holds information about the referrers that are accessing your downloads (e.g facebook or google) and lets you ban them if you dont want them to access your downloads.
  • linklogic_tokens - this table is the magic behind LinkLogic as it contains information about your files and the settings you want your downloads to have applied when they go public to your customers.
Managing Downloads

To add a new download to LinkLogic in "phpMyAdmin", click the name of the database you created earlier then next to the table "linklogic_tokens" click "insert" and follow the instructions below...

All downloads in LinkLogic have the following options...

filepath
token
filename
ipaddress
expires
verified
authorized
accesslimit
speedlimit
timestamp
  • filepath - the filepath to access the download excluding "http://www." or domain information for example "downloads/myfile.zip".
  • token - the key used to access the download, you can create a token by visiting "token.php"
  • filename - the filename you would like your users/customers to see when they click the download link.
  • ipaddress - the ip address of the person you wish to grant access to a download (if using IP validation) otherwise your ipaddress is fine to put here, you can find your current IP address from the following website: http://whatismyipaddress.com.
  • expires - the date and time you want your download to expire upon for example "25/12/2011 at 12:00" would be "25122011120000" and if you don't want your download to expire set this as "false".
  • verified - if you wish to use IP validation (see ipaddress above) set this to "true" otherwise "false" to disable it.
  • authorized - if you wish to assign a client to this download please set this to "true" otherwise "false" to disable it.
  • accesslimit - you can make your download expire after it has been accessed a certain number of times, to use this, simply set the number of times this file can be downloaded or if you dont want to use this set it as "false".
  • speedlimit - you can even set a download speed for your files, to use this, simply set the download speed you wish to use in "KB" or if you dont want to use this set it as "false".
  • timestamp - this is the time the download was added, this follows the same format as expires for example "25/12/2011 at 12:00" would be "25122011120000".

Once you have filled out all these fields, simply click "Go" and your download is ready to go. You can now access your download from the following URL..

http://www.mydomain.com/linklogic.php?token=[TOKEN]

if you would prefer a pretty way of provding downloads, please read the "Using .htaccess" section for more details...

To remove a new download to LinkLogic in "phpMyAdmin", click the name of the database you created earlier, then next to the table "linklogic_tokens" click "browse", find the download you wish to remove and click "Delete" next to that download. To remove multiple downloads click the checkboxes next to the downloads you wish to remove and click "Delete" at the bottom of the table to remove the selected downloads.

Tracking

To view the activity of your downloads in "phpMyAdmin", click the name of the database you created earlier, then next to the table "linklogic_logging" and click "browse". You will see a table like this...

filename
downloads
ipaddress
timestamp

Here you can see information such as how many times a file has been downloaded, the last ip address that accessed that download and when it was last downloaded.

Referals

When a referal has accessed your downloads, it is automatically logged to make managing your referals as simple as possible. To block a website from accessing your downloads is as simple as changing its status from "active" to "inactive", to do this in "phpMyAdmin", click the name of the database you created earlier, then next to the table "linklogic_referlas" and click "browse" You will see a table like this...

domain
blocked
timestamp

To add a referal, click "insert" and fill out all the required fields then simply click "Go" to apply your new rule. The modify a referal click "edit" next to the referal you wish to change then when you have made the desired changes, click "Go". And to remove a referal simply click delete next to the referal you wish to remove.

Blacklists

With LinkLogic you can block unwanted people from accessing your downloads, this is done by creating what we call a rule for that IP address. To do this in "phpMyAdmin", click the name of the database you created earlier, then next to the table "linklogic_blacklist" and click "browse" You will see a table like this...

ipaddress
blocked
timestamp

To create a rule click "insert" and fill out the required fields then once you are done click "Go" to add this rule, Removing rules is simple too just click "delete" next to the rule you wish to remove. To Modify a rule click "edit" next to the rule you wish to change and once you are done click "Go" to save the updated rule.

Clients

To manage a client in "phpMyAdmin", click the name of the database you created earlier, then next to the table "linklogic_clients" and click "browse" You will see a table like this...

client
quota (bytes)
blocked
timestamp

To add a client, click "insert" and fill out all the required fields then simply click "Go" to apply your new rule. The modify a client click "edit" next to the client you wish to change then when you have made the desired changes, click "Go". And to remove a client simply click delete next to the client you wish to remove. To calculate a file size in bytes, please visit the following website...

http://www.matisse.net/bitcalc/

Using .htaccess

To make you download URL's prettier you can always use .htaccess, to do this create a blank file in your text editor or if you already have a ".htaccess" file on your server you can use that, i would recommend notepad++, which you can download from the following url...

http://notepad-plus-plus.org/

once you have created a blank file insert the following code into the file...

RewriteEngine On
RewriteRule ^download/([^/]*)$ /linklogic.php?token=$1 [L]

and save the file as ".htacess", this file needs to be uploaded to the same directory as "linklogic.php" for this method to work correctly. If successful you can now use the following url for your downloads...

http://www.yourdomain.com/download/[TOKEN]

Download