Author Topic: media directory restrictions  (Read 11970 times)

0 Members and 1 Guest are viewing this topic.

Offline arindra

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
media directory restrictions
« on: April 26, 2005, 04:22:53 PM »
hey
how can we prevent users ( Guests ) from being able to simply copy paste a image url from the thumbnail link and then change the " thumbnail" to "media" and thus view the image , even without loggin in ?

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: media directory restrictions
« Reply #1 on: April 26, 2005, 06:03:45 PM »
Search the forums for pic security

This subject has been covered in great detail

Offline arindra

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: media directory restrictions
« Reply #2 on: May 05, 2005, 03:35:47 PM »
Hi guys ,
I have managed to find my solution , and this is the code i am using is below . hopefully this will help others . Put these codes in a .htaccess file under every directory u have under the media directory and upload the file .

Code: [Select]
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com/gallery/.*.php(/)?.*$     [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://www.mysite.com/gallery/ [R,NC]

What this will do :

this will allow you to prevent other sites from hotlinking your images . anyone trying to hotlink your images will now get get nothing .
Not just hotlinking from other site , my problem was : anyone copying the shortcut of the thumbnail files and changign the thumbnails to media , could easily be able to view the full images by Being a GUEST even !! . This will redirect those users to the homepage of your gallery ( u may change it to what u want ) .

Cheers

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: media directory restrictions
« Reply #3 on: May 05, 2005, 03:47:08 PM »
there is one issue with such method:
people with "Interent privacy" software which blocks referal page would not be able see the images on your site.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline arindra

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: media directory restrictions
« Reply #4 on: May 05, 2005, 04:16:45 PM »
internet privacy software such as net nanny ?

Offline arindra

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: media directory restrictions
« Reply #5 on: May 05, 2005, 04:19:43 PM »
if so , i am cool with it , coz ... i dont expect them to be much ... but on the other hand , it solves much of the problem in a much simpler way than the other codes anc changes to go through in the other Pic Security thread  :mrgreen:

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: media directory restrictions
« Reply #6 on: May 05, 2005, 07:06:02 PM »
Norton Internet Security is another and any other software or browser setting that disables sending referer information

Offline tippy

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: media directory restrictions
« Reply #7 on: October 26, 2008, 05:39:34 PM »
Hi guys ,
I have managed to find my solution , and this is the code i am using is below . hopefully this will help others . Put these codes in a .htaccess file under every directory u have under the media directory and upload the file .

Code: [Select]
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com/gallery/.*.php(/)?.*$     [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://www.mysite.com/gallery/ [R,NC]

What this will do :

this will allow you to prevent other sites from hotlinking your images . anyone trying to hotlink your images will now get get nothing .
Not just hotlinking from other site , my problem was : anyone copying the shortcut of the thumbnail files and changign the thumbnails to media , could easily be able to view the full images by Being a GUEST even !! . This will redirect those users to the homepage of your gallery ( u may change it to what u want ) .

Cheers

Sorry for dragging this back up to the top but I was trying to add this to my site to stop people from downloading my wmv/avi files directly from my site via viewing the page source and copying/pasting the direct data link.

Maybe Im not doing it right, my site is on an add-on domain, for example blah.hello.com, my gallery is installed in a sub folder blah/gallery.

I add this .htaccess file to all my directories under my media folder but when I try to watch a video it loads and just says ready, but the file doesnt play?

Anyone have any advice on how to make this code work?

Thanks,

Mike
ver : 1.7.4

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: media directory restrictions
« Reply #8 on: October 26, 2008, 07:56:10 PM »
Windows media player doesn't send the referrer when requesting the video file.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline tippy

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: media directory restrictions
« Reply #9 on: October 27, 2008, 09:34:40 PM »
Thanks for the quick reply V@no, much appreciated.

I did read through some of the posting in the "Pic Security" thread but from what I read there isnt a way to protect wmv/avi files unless I read it wrong, Im gonna go read the entire thread again.

I have to figure out some way to stop these people from directly accessing my /data/media files...

Thanks again,

Mike