Main Stories
Slash Boxes

Slash Open Source Project

Slashcode Log In

Log In

[ Create a new account ]

Article Poll

Poll I found this article to be
Very Helpful
Helpful
Not Helpful
Not Very Helpful
[ Results | Polls ]
Comments:0 | Votes:0

Karma based File Downloads

posted by Krow on 07:50 AM December 23rd, 2001   Printer-friendly   Email story
I have been running a slash site for about 2 years. I get over a 1,000 hits a day on it, but total there are only about 500 comments. And about 400 stories. Basically a lot of the visitors come and download the various PDF files that I have done. What I ended up doing has been to change directories of the files every other week to prevent people from hardlinking to it. I also have robots.txt and such set up to prevent search engines from spidering through out the site.

What I want to do is figure out a way to have a perl script or soemething serve up the file when people ask for it, but maybe based on their karma. Like they need to be registered and have a good Karma to be able to download files.

Any ideas on how to go about this? Any perl scripts I could look at?

This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login
Loading... please wait.
  • If you're using Slash 2.2, it's fairly easy. The heart of "download.pl" (or whatever) will be a call to isAnon() and a check of $user->{karma}. You can be obscure and redirect to the appropriate weekly location, or subtle, storing the files where the webserver cannot normally get to them, reading and printing them within the Perl program.

    I'm working on a plugin and an article concurrently, so I'll have some example authorization code for you in a couple of weeks. It's really simple.

    • Yes, I'm running 2.2. Very cool, looking forward to your examples....
      --

      --
      It's either on the beat or off the beat, it's that easy.
    • It was very easy to do. Thanks for the tip in the right direction.

      Now, how does one get a perl script to read and send out files that aren't accessible normally to Apache?

      --

      --
      It's either on the beat or off the beat, it's that easy.
      • by Anonymous Coward
        I believe apache allows spefic rights to be granted to defined files or filetypes. in conf/httpd.conf towards the end you'll see the section on this.

        hope this helps,

        orteling@hotmail.com

    • I've got Slash::Gallery, a picture gallery plugin, almost done. One of its features will be that you can only view pictures if that picture is assigned to a group that you are a member of. I'll make it publically available sometime in the next few weeks, probably.