Jump to content
xisto Community
electriic ink

How To: Hide The Real Url Of Your Images using php

Recommended Posts

wow , nice script,anybody ever tried it?

Yep, me. I've had it running on my site for about a month or so now. No problems with it.

If you want to decrease the size of the script but still want it to remain just as functional as it was before, change:

if (!$ext) {echo "Could not find appropiate information";exit;}if (!$filename) { echo "Could not find appropiate information";exit;}if (!$img) {  echo "Could not find appropiate information";exit;}

To...

if (!$ext || !$filename || !$img) {echo "Could not find appropiate information";exit;}

Share this post


Link to post
Share on other sites

Wow this is definately an awesome script - wicked usefull!One question I have tho is how does the browser handle the image? Will the browser still cache the image locally? Cus if it didnt that might result in an increase of BW :ph34r: But the whole idea of hiding the url is one i have been thinknig about for a while - especially since someone posted somewhere else in the forums that someone has been rippin images off thier site and using there bandwidth and crazy stuff like that Gratz on the Hotscript success by the way!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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:

 

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

 

on img.php add this:

 

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

After this line:

 

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.

Share this post


Link to post
Share on other sites

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.

190903[/snapback]


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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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, (Xisto 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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.