Script to limit number of times a file can be downloaded...
I want to allow the first x number of people to click on the link to download the file...does anyone know of a script that will do this? Preferably free ?
Thanks so much!
I want to allow the first x number of people to click on the link to download the file...does anyone know of a script that will do this? Preferably free ?
Thanks so much!
dk01 posted this at 17:03 — 25th December 2005.
He has: 516 posts
Joined: Mar 2002
I know you could write one from scratch if you have php/mysql. Do you have any experience in this?
CptAwesome posted this at 18:59 — 25th December 2005.
He has: 370 posts
Joined: Dec 2004
pretty simple really, I could write a mod of php script I wrote awhile back if you'd like.
digidivakathy posted this at 02:28 — 26th December 2005.
They have: 22 posts
Joined: Nov 2005
My only experience is googling the things I needed to know to build my site and customize it, but I used packaged programs, so there wasn't that much to do. I'm quite certain I would not be able to write the script. There are tons of scripts at hotscripts.com that do some really cool stuff like hiding the real address of the link, providing the number of downloads, etc... and I like those features, but I really want to be able to do this too, in some circumstances. So, if anyone has something that can be slightly modified and will do all of those things or knows of a script/program, that would be perfect.
Thanks so much!
bja888 (not verified) posted this at 03:22 — 26th December 2005.
They have: 5,633 posts
Joined: Jan 1970
If I read you currectly you want to do more then just hide the link. People like me who used a download manager keep the address of all the files they download. So I can easily download the file as many times as I want.
As alturnative, you can require the user to login and route the file through a php or asp page and return a error 401 is they try to access the page without logging in.
The second option requires a little more advanced scripting. You might be able to mesh a few scripts togeather but you better off to buy one or pay for a custom.
digidivakathy posted this at 03:33 — 26th December 2005.
They have: 22 posts
Joined: Nov 2005
Right, I don't just want to hide the link, but that is part of it. I don't want someone to send the link to their friend...if their friends wants my file, I want them to come to the site to get it. BUT, the other thing is that I want to be able to, at times, say, hey, the first 10 people to visit my blog can grab this cool thing and then be sure that only the first 10 people are able to download the file. But, I don't want to do it badly enough to have to have to pay for a custom script. Don't mean to sound cheap, but I have to be right now...it's my own site and I can always hand out the links one at a time if I have to to accomplish this. I'd just rather be able to do it with a script and make it automatically "expire" after the designated number of downloads.
Thanks!
dk01 posted this at 09:32 — 26th December 2005.
He has: 516 posts
Joined: Mar 2002
The way to do this is to create a timestamp ticket and an ip hash. So for example say I click the download link. My link to the file should include a timestamp ticket and an ip ticket (both md5 hashed maybe). People's tickets should be valid for about 5 min and only for their ip. Sure its not a perfect system but its the best you can do. Basically you have.
download.php?dlid=a96b598bc321|a908093ce5b45b
The first number should be the timestamp combined with a randomly generated key and the second should be their hashed ip combined with a randomly generated key.
Each time a new ticket is issued you put it in your database. Your db should be like this kinda:
| id | hash time | actual time | hash ip | real ip |
| 1 | a96b598bc321 | 10234563583 | a908093ce5b45b | 90.67.56.43 |
| 2 | d56b598bc674 | 10234564683 | 8708093ce535cd | 10.78.48.89 |
Anyhow yeah. That way you can keep track of who is coming on (as long as they don't use a proxy) and also can keep track of how long they are on. Once the id gets to a certain number you just block any more entries from being entered and therefore the php file should block any incoming requests.
digidivakathy posted this at 13:54 — 26th December 2005.
They have: 22 posts
Joined: Nov 2005
Okay, that is so far over my head I am drowning, LOL. Maybe I better stick to the e-mail system because I have no idea what you are talking about there or how to make it happen...so, there are no scripts that anyone knows of that will do this out of the box? Sorry for being such a newbie !
dk01 posted this at 15:35 — 26th December 2005.
He has: 516 posts
Joined: Mar 2002
My mistake Kathy. I was under the impression you wanted to know about how this is done in a technical sense. Sorry to overwhelm you.
I don't know of a script that does this automatically but I can tell you that without knowledge of a language like php or asp it will be tricky to get this fairly technical script to work on your own. What kind of platform are you looking to do this on? Who is your site's host?
digidivakathy posted this at 15:48 — 26th December 2005.
They have: 22 posts
Joined: Nov 2005
Oh, no need to apologize. I love to learn and I've learned everything I do know (which isn't much, LOL) from nice people and googling the things I was trying to do. BUT, yeah, this is a bit more technical than the stuff I've done so far. I really thought I'd be able to find a pre-made script to do it, but I guess it's maybe a strange request. I downloaded and installed a program I found at hotscripts.com and like everything about it, but it doesn't give me the ability to do that one key thing...stop the download's availability after the first X number of downloads. People won't be downloading the file more than once, once they have it, they have it. But, I just want to be able to do an occasional giveaway of my products (I create digital scrapbooking kits) to the first few people who stumble upon the link on my blog and this would be the easiest way to make it happen.
As for my host, it's Worry Free Webhosting. Platform? Ummm...okay, pardon my ignorance, but is Linux the answer to that question ?
Thanks for your patience with a newbie!
digidivakathy posted this at 16:16 — 26th December 2005.
They have: 22 posts
Joined: Nov 2005
I actually found a script that I think will work perfectly for me, but it doesn't have an install script, so I have to figure out how to create a table in my database... I'm sure that's something I needed to learn, anyway. It was $7, but, hey, that's cheap if it solves my problem, LOL.
Thanks for the help everyone!
dk01 posted this at 16:30 — 26th December 2005.
He has: 516 posts
Joined: Mar 2002
Glad to hear you solved your problem Kathy! Sometimes you have to just bite the bullet and pay for a utility here and there. If you have problems with the install feel free to come back here for help.
..oh and remember, we were all newbies one day!
digidivakathy posted this at 16:42 — 26th December 2005.
They have: 22 posts
Joined: Nov 2005
Well, since you asked ...
I have never had to manually create a table before. I have access through phpmyadmin and have already added the database, just need to create the table fields, I think. Here's what was in the read_me file...
# Table structure for tables `dlm_files` and `dlm_stats`
CREATE TABLE `dlm_files` (
`id` int(11) NOT NULL auto_increment,
`path` tinytext NOT NULL,
`daily_limit` int(11) NOT NULL default '0',
`total_limit` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
CREATE TABLE `dlm_stats` (
`dl_date` date NOT NULL default '0000-00-00',
`file_id` int(11) NOT NULL default '0',
`dl_count` int(11) NOT NULL default '0'
) TYPE=MyISAM;
I know my host will do this for me when I can catch up with him, but I would love to understand how to do this myself, so if there are some basic instructions you could share with me, that would be awesome.
Seriously, thanks so much! I really appreciate this community and the help I've found here .
dk01 posted this at 17:00 — 26th December 2005.
He has: 516 posts
Joined: Mar 2002
Ok if you have phpmyadmin then you can do it easily.
First open phpmyadmin and on the left hand side select from the dropdown the database you created. Now click the SQL tab in the middle of the screen.
Just copy/paste this:
# Table structure for tables `dlm_files` and `dlm_stats`
CREATE TABLE `dlm_files` (
`id` int(11) NOT NULL auto_increment,
`path` tinytext NOT NULL,
`daily_limit` int(11) NOT NULL default '0',
`total_limit` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
CREATE TABLE `dlm_stats` (
`dl_date` date NOT NULL default '0000-00-00',
`file_id` int(11) NOT NULL default '0',
`dl_count` int(11) NOT NULL default '0'
) TYPE=MyISAM;
Into the Run query textbox. Then click the go button below the text box. You should be good to go!
digidivakathy posted this at 17:25 — 26th December 2005.
They have: 22 posts
Joined: Nov 2005
Wow, that was easy! I had no idea it was that simple to do it. See, I just learned something else today.
Thanks so much!
dk01 posted this at 21:28 — 26th December 2005.
He has: 516 posts
Joined: Mar 2002
Glad to help you learn something new! Good luck!
-Jim
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.