close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

DFP2 - restricting number of downloads

Thread began 2/02/2010 9:55 am by Martin317528 | Last modified 2/18/2010 12:18 am by Badger | 2845 views | 8 replies |

Martin317528

DFP2 - restricting number of downloads

Hi

RE: DFP2 - restricting number of downloads

Couldn't find any instructions in support or forum how to simply restrict the number of times someone can download a file. I've created a database file:

`xID` int(10) NOT NULL auto_increment,
`user_ID` int(50) default NULL,
`filename` varchar(255) default NULL,
`date` timestamp(14) NOT NULL,
`file_count` varchar(255) default NULL,

The download button works. Now just need to restrict the number of times someone can download the file (plus add some error messages to tell them this if they try)....

Sign in to reply to this post

Jason ByrnesWebAssist

In the file download server behavior, you can set it to use the file_count column to increment each time the file is downloaded.



you need to create a recordset that checks the file count column:
SELECT * FROM table WHERE xID = 1 AND file_count <= 5


and use the Dreamweaver Show region behavior to show the download link if the recordset is not empty or show the error if the recordset is empty.

Sign in to reply to this post

Martin317528

Hi Jason, That works really well, but...

We're trying to avoid multiple downloads from one person (someone created a bandwidth bill that nearly bankrupted us!). In the above solution if you don't refresh the browser you can just keep clicking download multiple times. We need it to only be able to download once or maybe twice. Is there a way to do this using the session. Also, can we have how to achieve the error messages. Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

put the download link on one page, have it go to a download page. On the download page, create the recordset and add the download file server behavior.


You can set the download file server behavior to only trigger if the recordset is Not empty. Also add an error to the download page to show if the recordset is empty.

Sign in to reply to this post

Martin317528

Thanks Jason, that works well.

Is there an easy way to code an auto reset of the count to 0 after a set time (say 24 hours)?

Sign in to reply to this post

Jason ByrnesWebAssist

This is referred to as a Cron Job:
introducing-cron



a cron job will run at a set time and can be used to update your database. Simple is a relive term with cron jobs, first your host must support them and you need to be comfortable writing the script.

Sign in to reply to this post

Badger

Thanks. Is it possible for an email to be sent to the site owner when the count reaches a certain number using Universal Email? IE to warn him to reset the counter.

Sign in to reply to this post

Jason ByrnesWebAssist

sure, you can use universal email and set the trigger to the recordset being empty.

Sign in to reply to this post

Badger

That is simple and brilliant. Many thanks

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...