Sublime directory Surf the web anonymous Pagerank Monitor


Limiting the number of files downloads from your site

jimkoh
Wed 18 February 2009, 04:24 pm GMT +0100
Hi all

I am new here and new to php and javascript as well.
After reading some posts from Olaf regarding some similar problem I am facing, I wonder if anyone of you are able to help.

Olaf post:
First we need a database to store the file path, the IP address and the last download time:
CREATE TABLE IF NOT EXISTS `downloaded` (
`filepath` varchar(255) NOT NULL,
`ipadres` varchar(15) NOT NULL,
`last_access` datetime NOT NULL,
UNIQUE KEY `filepath` (`filepath`,`ipadres`),
KEY `ipadres` (`ipadres`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

How to go about doing this?

I want to setup a site that allows member to download some pdf, exe or zip files.
They are only allowed, says 100 files per month.
So if someone uses up his download quota beginning of the month, he will have to wait until the 1st of the next month before he can download from my site again. That means on the 1st of every month, at 0:0:00 hour, member's download quota will be refreshed.

Can this be done?

Here are my server and site details.
I am using a shared hosting server running on Linux, Apache 2.2.11 (Unix) PHP 5.2.5, MySQL 5.0.67-community.
Site hosted using Joomla 1.5.9

Will be glad if anyone can help.

Jim

Nikolas
Thu 19 February 2009, 06:18 am GMT +0100
To create the database table is very simple. You can login to phpmyadmin and do it by pasting Olaf's command in the SQL tab.

But if you don't know php I guess you should probably hire someone to do this for you, or use a ready made script.

I think here at webdigity there is a script for that but I really don't remember where.

jimkoh
Thu 19 February 2009, 07:19 am GMT +0100

Thanks a lot Nikolas for the speedy response.

Ok thanks again for advice, I have done this before and should have no problem doing it again.
From the downloaded script provide by Olaf the refresh time is set at 3600 seconds for the same file to be downloaded but my scenario are different.
"I want to setup a site that allows member to download some pdf, exe or zip files.
They are only allowed, says 100 files per month.
So if someone uses up his download quota beginning of the month, he will have to wait until the 1st of the next month before he can download from my site again. That means on the 1st of every month, at 0:0:00 hour, member's download quota will be refreshed."
Can this be done?
Hope Olaf can really help this time.

Nikolas
Thu 19 February 2009, 07:49 am GMT +0100
Of course it can be done. You need to keep one field with user's months downloads (which will be reset in 1 of each month, maybe with a cronjob)

Then when someone tries to download you should first check if the user have downloaded 100 files (by checking that field's value)

And when someone downloads you should update the field (UPDATE `field` = `field` + 1 WHERE `userID` = $userID)

olaf
Thu 19 February 2009, 09:33 am GMT +0100
Just limiting the number of downloads is easy if the files are smaller.

I wrote that tutorial because customers has to download bigger files (500MB) and some of them used a download client.

@jimkoh,
I'm pretty sure that my code works for your of you change the number of downloads and and the time period (you don't need to store the file name)

Albie Mathews
Fri 21 May 2010, 01:28 pm GMT +0200
Try to use wamp, it will help you a lot.

mividazul
Sat 29 May 2010, 08:03 am GMT +0200
sorry i don't know more about this

ghdfans2010
Wed 16 June 2010, 08:45 am GMT +0200
I'm new here! I'm new to computer and search engine optimization. Thanks for your post! I have learnt so much from your post! I have built a own website about ghd hair straighteners.There are many competitors in the market.So everyday I need to visit many websites about SEO and computer to learn. If you can help me,please give me some hand.

C0ldf1re
Wed 16 June 2010, 03:39 pm GMT +0200
I think here at webdigity there is a script for that but I really don't remember where.

I've tried a forum "search" to no avail. A script like that seems essential to stop jokers who will exhaust your bandwidth. Does anybody remember the script location?

Archive for SMF v1.00 by N.P. Valid XHTML 1.0 Transitional