The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Hotlink protection: securing PHP-generated images

Discussion in 'General Discussion' started by Kelmas, Jul 1, 2008.

  1. Kelmas

    Kelmas Well-Known Member

    Joined:
    Nov 6, 2006
    Messages:
    121
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Lithuania
    I used cPanel's hotlink protection, which uses mod_rewrite rules, but it protects only static images, like file.jpg, mypicture.gif etc.

    On my system I have a PHP script that generates image, so URL to it is something like image.php?photo=123 where 123 is unique image number. How do I build a rewrite rule to protect this type of image?

    Tried diffrent ways but no luck :confused:
     
  2. pross

    pross Well-Known Member

    Joined:
    Mar 14, 2005
    Messages:
    75
    Likes Received:
    0
    Trophy Points:
    6
    surely u could add a line to check that $_SERVER['HTTP_REFERER'] is your server if not deny the image
     
  3. Kelmas

    Kelmas Well-Known Member

    Joined:
    Nov 6, 2006
    Messages:
    121
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Lithuania
    Yes, but maybe there's a way to implement this into .htaccess so that I could have all hotlinking protection in one place...
     
Loading...

Share This Page