Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
* * * * * 2 votes

How To: Hide The Real Url Of Your Images


29 replies to this topic

#21 Ex Fx

    Newbie

  • Kontributors
  • Pip
  • 4 posts

Posted 01 October 2005 - 07:26 AM

very useful script

#22 sxyloverboy

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 302 posts
  • Location:Frankfurt, Germany

Posted 01 October 2005 - 09:57 AM

what might be good is a page where we can see this scipt in use. i mean does this also prenevnt people for right clicking the image and then pressing View Image? how would that show in the url box in a browser. Maybe it will show diffrently for diffrent browsers. sorry for being so critical but other than that nice script.

#23 electriic ink

    "Britons never never shall be slaves." As true now as it was in 1740.

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,262 posts
  • Gender:Male
  • Location:Heaven
  • Interests:Promotion: Aug 4 2005 8.24pm BST
  • myCENT:74.43

Posted 01 October 2005 - 12:24 PM

The script is currently in use on my website. Right click and do view image on the any of the images on the website and (in firefox I know that) you may be surprised :huh:

In the browser, when you do view image, the url will be http;//example.com/img.php?fl=IMAGE&type=2 etc. On my example website, you'll see that I edited the variables in the url.

The cache question however I am unsure about.

If you wish to get image protection, here is a small script I will provide for you:

[hr=noshade][/hr]

Place this on whatever php enabled webpage you want to allow images to be displayed (note it maybe a good idea to alter the contents of the variable):

<? 
$allowImage = "1a2b3c4d";
?>

Just before this line:

Quote

/* Firstly let's see if the variables have information in them */


on img.php add this:

if ($allowImage == "1a2b3c4d") {

After this line:

Quote

include $img . $filename . "." . $ext;

add this:

} else {

echo " <script> window.alert (\"This image has been protected. You are NOT ALLOWED to see it when attempting to get to it directly.\"); </script>";

}

I'm not sure if this works but try it. I doubt though that it will protect right click, save as. What I do think it'll protect is:
  • Image Hotlinking
  • Accessing images directly
When someone hotlinks your image, the nasty red cross will appear when they view your page. If they access the image directly, the alert will appear.

Note: This script has not been tested but I am 99.99% sure it'll work, please make backup copies of your files first.

#24 xJedix

    Premium Member

  • Kontributors
  • PipPipPipPipPipPipPipPip
  • 183 posts
  • Location:Minnesota
  • Interests:Computers :)

Posted 01 October 2005 - 06:20 PM

cmatcmextra, on Oct 1 2005, 06:24 AM, said:

The script is currently in use on my website. Right click and do view image on the any of the images on the website and (in firefox I know that) you may be surprised :huh:

In the browser, when you do view image, the url will be http;//example.com/img.php?fl=IMAGE&type=2 etc. On my example website, you'll see that I edited the variables in the url.

The cache question however I am unsure about.

If you wish to get image protection, here is a small script I will provide for you:

[hr=noshade][/hr]

Place this on whatever php enabled webpage you want to allow images to be displayed (note it maybe a good idea to alter the contents of the variable):

<? 
$allowImage = "1a2b3c4d";
?>

Just before this line:
on img.php add this:

if ($allowImage == "1a2b3c4d") {

After this line:
add this:

} else {

echo " <script> window.alert (\"This image has been protected. You are NOT ALLOWED to see it when attempting to get to it directly.\"); </script>";

}

I'm not sure if this works but try it. I doubt though that it will protect right click, save as. What I do think it'll protect is:
  • Image Hotlinking

  • Accessing images directly
When someone hotlinks your image, the nasty red cross will appear when they view your page. If they access the image directly, the alert will appear.

Note: This script has not been tested but I am 99.99% sure it'll work, please make backup copies of your files first.

View Post


To prevent people from taking images by using right-click, just put in a disable right-click script. It comes in useful in some situations but you are never going to be able to totally protect your images. If I really wanted an image, i could just take a screenshot of the site and cut it out :P

I think its a really handy tool. I do this on my clan site but for the pages. I use a re.php to redirect the link to the correct page to mask what the actual page name is. There are ways around this too but it helps against noobs :\

xJedix

#25 mendezgarcia

    Newbie [Level 3]

  • Kontributors
  • PipPipPip
  • 46 posts

Posted 01 October 2005 - 11:04 PM

Sorry, but I am not understanding the purpose of this script.

I will point some cons:

- People will still be able to hotlink to it - also, this will make usual hotlinking protection useless.

- About the cache thing, no, the browser will not cache the images, thus increasing your
bandwidth use.

- The other point is that it will make creating pages harder (you will have to write a longer address for img src)

- Scripts that rely on user input are EXTREMELY dangerous. For example, due to a huge design flaw
(if you give some ext like 934910841 it won't be concatenated to the file name; allowing a potential
hacker to inject code or see your files).

Now, some coding tips:

- I noticed unexperienced coding standards, especially indentation for the PHP code.

- Usually instead of using several if and elseif you can use switch

- Use $_GET instead of $_REQUEST

- Be careful with your error checking routine; check if the given ext actually exists.

- Instead of naming an ext an using switch/if else, you can use an array; for example:
$exts = array ('jpg', 'gif', 'bmp', 'png', 'tiff')
$exts[0] is jpg, $exts[1] is gif and so on.

- Learn about INTERPOLATION.
Strings using double quotes (") don't need to be concatenated.

- And finally, the most important: NEVER TRUST USER INPUT!!
Always filter it properly

I hope you don't take this as offense, but as constructive criticism.

#26 thebluekirby

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 421 posts
  • Location:Somewhere over the rainbow

Posted 02 October 2005 - 02:39 AM

wow, I had no clue a script like this even existed XD awesome, i'll probably use it!!!

#27 minimcmonkey

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 414 posts
  • Gender:Male
  • Location:United Kingdom
  • myCENT:62.89

Posted 02 November 2008 - 03:07 PM

That could be quite useful, however, the best thing to do, is to use hot link protection, any web hosting with cpanel can do this, (trap17 included) and set the URL of the hot link page to an image, then, if anyone uses an image from your site, using a URL of your site, the hot link image is displayed. That way, the site is advertising you site.
Using images without permission is illegal anyway if you haven't said otherwise, so people shouldn't do it.

#28 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 07 November 2009 - 05:35 AM

Hide The Real Url Of Your ImagesHow To: Hide The Real Url Of Your Images

Hope this site would help anyone who needs to hide the image name and the path .This a great service and it helps people who dosen't have much web technology 

http://pvtlink.Com

Happy hiding!

-reply by chamara

#29 Guest_Eric_*

  • Guests

Posted 12 September 2010 - 04:31 PM

Hi! everybody,
I have been trying to use this particular script but i get the following PHP error Parse error: syntax error, unexpected T_STRING in /home/a9844807/public_html/images/SharedImages/kaysInternet1.jpg on line 1
I'm quite kinda green to PHP. somebody should help me.Thanks!

#30 Guest_Gabor Pozsgai_*

  • Guests

Posted 10 March 2012 - 03:40 AM

Does not work for me :( When I run the external php it does seem to see the image (showing weird characters, just like when I open an image width editor). On the main page however the image does not appear. Any ideas?




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users