Perfect File Protection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • REMbraNT
    Confirmed User
    • Feb 2001
    • 241

    #1

    Perfect File Protection

    I have problems to make a good hotlink protector system.I use a php redirect file but I have a little problem with it.In this case when the user want to dl a file called 22.jpg he will be asked to dl the file as redirect.php.How can I keep the original file at download?

    <?
    if ( $HTTP_REFERER=="http://www.myname.com/images/members/") {
    $filename="/home/images/data/" . $QUERY_STRING;
    $mimetype = `file $filename | magic2mime`;
    header("Content-type: $mimetype");

    $fp = @fopen ($filename, "r") or die("Nincs ilyen file!");
    while (!feof ($fp)) {
    $buffer = fread($fp, 4096);
    echo $buffer;
    }
    fclose($fp);
    } else {
    include("../../data/error.html");
    }
    ?>
    Bizsuk
  • TFCash
    Confirmed User
    • Apr 2001
    • 1738

    #2
    REMbraNT =

    I would suggest that you not use php for protecting your images, and instead use the mod_rewrite that can be enabled on the apache web server. I've done testing on this before (Since we are a web host, we like to know what works best for our customers ) And using php will add more overhead than the mod_rewrite will.


    Tim
    TeenFlood.com Online since 1998.

    TFCash KissMeGirl
    VirginRiches MondoBucks

    tim at tfcash.com or submit a ticket at our HelpDesk

    Comment

    • REMbraNT
      Confirmed User
      • Feb 2001
      • 241

      #3
      hardcorehosting and what works best for your costumers?
      I need an idea
      Bizsuk

      Comment

      • TFCash
        Confirmed User
        • Apr 2001
        • 1738

        #4
        Ask your host if they have mod_rewrite compiled into their apache web server. If so you should be able to create a file call .htaccess in your images directory that is something like this:

        AuthUserFile /dev/null
        AuthGroupFile /dev/null

        RewriteEngine On

        RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com.* [NC]
        RewriteCond %{HTTP_REFERER} !^http://yourdomain.com.* [NC]

        RewriteRule /* http://www.yourdomain.com/index.html [R,L]

        That way only you can call the images from those directories, that have proper permission.

        To see an example of what I mean try looking at this photo, it will automatically take you to my main page.
        http://www.lesbian-pictures.com/Sun/15/pic1.jpg

        it will redirect you back to http://www.lesbian-pictures.com/

        And I don't want to hear any shit about the look of the site either, we just got the domain and I threw it together so that I don't lose all that wonderful traffic that my pain in the ass from Turkey paid for. In case your not sure what I'm talking about you can read the thread here about it
        http://bbs.gofuckyourself.com/board/...ML/002711.html

        Tim
        TeenFlood.com Online since 1998.

        TFCash KissMeGirl
        VirginRiches MondoBucks

        tim at tfcash.com or submit a ticket at our HelpDesk

        Comment

        • REMbraNT
          Confirmed User
          • Feb 2001
          • 241

          #5
          Ok hardcore I will inform you if it works well for me
          Bizsuk

          Comment

          Working...