Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image leeching 1

Status
Not open for further replies.

gwar2k1

Programmer
Apr 17, 2003
387
GB
My friend has a website that is a place for her art. Everymonth she exceeds her bandwidth due to people directly linking to her images even though she says do not do it.

She has tried using a httaccess file with the following script:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^ [NC]
RewriteCond %{HTTP_REFERER} !^ [NC]
RewriteRule .*\.(gif|GIF|jpg|JPG|png|PNG|bmp|BMP|jpeg| JPEG|zip|ZIP)$ [R]

provided by Cian in thread65-676739 but it doesnt work.

I was wondering (and hoping) if there is a better / alternative way to stop leeching without the use of a .httaccess file. Any one know anything?

Thanks in advance

~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
 
well if she has php then just use sessions.

Code:
session_start();
$leechers = "1";
session_register("leechers");

so put that in the home page
then in the pages that she wants protected

Code:
session_start();
if (!isset($HTTP_SESSION_VARS['leechers']) || $HTTP_SESSION_VARS['leechers'] != "1") {
  header ("Location: homepage.php");
}

then to unregister the session -- say they link to another page of the site and she only wants people to access the image from one page

Code:
session_start();
session_unregister("leechers");

so using sessions and unregistering them you can make sure that an image can only be viewed from one page. By unregistering the session after the image loads the user would have to click on the original link to take him back there -- that means however that the page would have to be refreshed to reregister the session.

You can make the session value whatever you want. You can have different sessions for different images and pages to ensure security.

This is the easiest way that I would know how to do without using javascript -- but javascript can be disabled and php cannot.


<signature>
sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
</signature>
 
um. im not quite sure what goes on. if i put *all* of those snippets of code in the one page (say index.php has a selection of images), the user can view them on that page but no other? So if they clicked on the image (which then shows the image by itself) they wouldnt be able to see it?

Um... how do I not make this happen? I need the user to be able to view the image on the site but not on an external site

Sorry, useful code for sessions though thanks =D

~*Gwar3k1*~
&quot;To the pressure, everything's just like: an illusion. I'll be losing you before long...&quot;
 
ok I read it wrong --

Wont an easy way be to put the pages with the images in a protected directory on your server. So the only way to access the files would be to enter a username and password.

Anyway here is a form for htaccess


try this out. It goes step by step

<signature>
sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
</signature>
 
Just change the file names on a regular basis and place some pornographic images in the same directory with the old filenames. The leechers will soon learn their lesson when their 'Art' pictures get replaced with midget porn.

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
 
Have a look at Stopping people saving images (Thread215-620990), especially EdwardMartinIII's first post.

If you can't stop them with httaccess or session-marking or similar, just blast them with legalese :)

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
that is different than what he wants. What that thread asked for is impossible. here he just wants to stop hotlinking

Sometimes the Answer You Are LOOKING for can be FOUND BY SEARCHING THE FAQ'S @&%$*#!!!
 
Also bear in mind that not all browsers send an HTTP_REFERER (meaning that legitimate visitors may be barred from seeing the images), whilst a canny leecher could spoof your server with a fake HTTP_REFERER value.

I don't see how deecee's PHP code is going to be added to an image file, you'll have to use some kind of cgi script to verify the access and serve up the files. You can get at a selection of such scripts (some free, some not) at


Having said that, the examples I looked at seemed to rely on HTTP_REFERER - with consequent problems mentioned above.

I think if I was doing the site, I'd have unprotected thumbnail images of the art, but use a script to password-protect the full-size images. It'd need to be the type of system where the password was displayed as an image of random letters which the user had to type in - you see it done on download sites all over the place.

-- Chris Hunt
 
i know my script was wrong for this -- i read the question wrong

Sometimes the Answer You Are LOOKING for can be FOUND BY SEARCHING THE FAQ'S @&%$*#!!!
 
If she's a on unix/linux host with apache, then she can use htaccess, otherwise any other webserver software doesn't recognize it.

Apache on any platform supports htaccess, it is not platform dependant.

gwar2k1

Please state more clearly what &quot;but it doesnt work.&quot; means.

What do your error logs say?
What happens when you try it?
Have you tried adding this to the httpd.conf?
Is ther file actually called httaccess or is that a typo in your post?

Hope this helps

Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
Correct me if i'm wrong, but i think that you can put all of the images in a restricted folder. To gain access to the folder a session variable must be declared to a certain value, or a cookie be on the clients computer. This will prevent the links to not function since they won't have access to the folder where the images are stored....

The other way is to embed all of the pictures in a flash swf. You can use actionscript so the swf will not work on any server but hers...
 
Thankyou all so much =D So many suggestions! Im gonna start with the httaccess script generator then work my way down. any typos are typos, errors are: Forbibben / Internal server errors. Theres no access to the error log files as its a paid host, not our own. I did check the FAQs they just suggest all the no-right click, transparent image stuff which isnt what i/we/she wants.
Im not gonna change the file names every so often (this is an image website... it would take too long) but the porn idea is comical. As is the steaked heads suggestion by EdwardIII =P

Cheerz!

~*Gwar3k1*~
&quot;To the pressure, everything's just like: an illusion. I'll be losing you before long...&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top