Page 1 of 1

Leeching Question

Posted: Mon Apr 19, 2004 9:31 pm
by JohnDigweed
Hi,

I am hiding the URL of images using GD Library. Is there a way so that the picture will not be shown unless the URL of the site is my site?

Like lets say I would use <img src="http://www.mysite.com/stuff.php">

Stuff.php contains the image made in php

Now, mr. someone from leecher.com likes my image, looks at the img src. He uses <img src="http://www.mysite.com/stuff.php">
even though his web site is http://www.leecher.com. Is there a way to protect it so the script does not show?

Could I use this code?

Code: Select all

<?
$domaincheck = $_SERVER&#1111;'HTTP_REFERER']
$mydomain = "http://www.mysite.com";

if($domaincheck == $mydomain)&#123;
    echo 'You may download files. ';
&#125; else &#123;
    echo 'Sorry, you may not download any files. ';
&#125;

?>
Another question, will the 'if' command recognize http://www.mysite.com/links.php, since I only set it to http://www.mysite.com?

Thanks.

Posted: Mon Apr 19, 2004 9:36 pm
by Steveo31
I'm pretty sure that if they link to the .php page, the image will show. However, you may also be able to use some regex with the URL to make sure that the server it is being shown on is, indeed, yours.

Posted: Mon Apr 19, 2004 9:57 pm
by JohnDigweed
Is there another way limit the showing of stuff.php as an image, then?

Also, could you lead me to where regex is?

Thanks.

Posted: Mon Apr 19, 2004 11:40 pm
by phice
I tend to use perl regular expressions more often, you can find these at http://us4.php.net/pcre (tutorials at http://gnosis.cx/publish/programming/re ... sions.html)