28, May 2012

Limiting the number of files downloads from your site - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Design and Layout  >  General webmaster discussions (Moderator: Meth0d)
Topic: Limiting the number of files downloads from your site
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: Limiting the number of files downloads from your site  (Read 1205 times)
Google dot what?
*
Posts: 2
16 credits
Members referred : 0


« on: Feb 18, 2009, 04:24:14 pm »

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
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #1 on: Feb 19, 2009, 06:18:32 am »

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.

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Google dot what?
*
Posts: 2
16 credits
Members referred : 0


« Reply #2 on: Feb 19, 2009, 07:19:23 am »


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.
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #3 on: Feb 19, 2009, 07:49:38 am »

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)

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #4 on: Feb 19, 2009, 09:33:48 am »

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)

Novice Spammer
***
Posts: 100
624 credits
Members referred : 0


« Reply #5 on: May 21, 2010, 01:28:30 pm »

Try to use wamp, it will help you a lot.
Novice Spammer
***
Posts: 100
600 credits
Members referred : 0


« Reply #6 on: May 29, 2010, 08:03:06 am »

sorry i don't know more about this
I love Pokemon
*
Gender: Female
Posts: 14
92 credits
Members referred : 0


« Reply #7 on: Jun 16, 2010, 08:45:13 am »

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.
Computer Avant Garde
***
Posts: 201
1230 credits
Members referred : 0


And the devil, taking him up into an high mountain


« Reply #8 on: Jun 16, 2010, 03:39:28 pm »

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?


Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=8525
Tags : create table in datebase limit download quota Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Design and Layout  >  General webmaster discussions (Moderator: Meth0d)
Topic: Limiting the number of files downloads from your site
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 11:26:43 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.