• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need help with a simple Perl script

jhbball

Platinum Member
So, I was interested in writing a script that would redirect users to a download page when clicking a button. The problem is, I don't want user to be able to bookmark the download page, I want them to click the "Yes, I agree to these terms" button before downloading content.

I'm very new to Perl, how would I go about doing this?
 
I could be wrong, web development is one of the few things that I absolutely can't stand. But off the top of my head what you proably want is a page that requires a valid session and "Yes, I clicked that button" variable be passed to it and if not you redirect them back to either the terms page or somewhere else.
 
First, it's worth noting that it's pretty much impossible to completely prevent someone from automating their way to said download page, unless you use an actual login scheme. The best you can do is make it difficult to circumvent.

The easiest thing to do would be to have the "I agree" button post to a script that checks the server "referrer" variable. This variable contains the address of the page that led the user to the current page - check if this is the "I agree" page and allow if it is, otherwise deny. Using Perl and Apache, something like:

if( $ENV{HTTP_REFERER} eq "/agree_to_terms.html" ) {
print "heres the download link";
else {
print "you didnt agree to stuff";
}

This is "relatively" easy to circumvent, but enough to keep most people out. For a more sophisticated route, you can use something like Nothinman suggested. Just be aware that a bot could replicate any of these steps if someone cared enough to do so.
 
Another thing that I've seen is some websites will generate a unique link for downloads (or for whatever purpose). After a certain time period, that link will expire.
 
Back
Top