Add to Google

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

Pages: 1, 2, 3
free web hosting
Open Discussion > CONTRIBUTE > Tutorials

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

dogomchawi
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 sad.gif

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!

Comment/Reply (w/o sign-up)

Ex Fx
very useful script

Comment/Reply (w/o sign-up)

sxyloverboy
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.

Comment/Reply (w/o sign-up)

cmatcmextra
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 smile.gif

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):

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


Just before this line:

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


on img.php add this:

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


After this line:

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


add this:

CODE
} 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:
  1. Image Hotlinking
  2. 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.

 

 

 


Comment/Reply (w/o sign-up)

xJedix
QUOTE(cmatcmextra @ Oct 1 2005, 06:24 AM)
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 smile.gif

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):

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


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

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


After this line:
add this:

CODE
} 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:

  1. Image Hotlinking
  2. 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.
*



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 tongue.gif

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

Comment/Reply (w/o sign-up)

mendezgarcia
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.

Comment/Reply (w/o sign-up)

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

Comment/Reply (w/o sign-up)

minimcmonkey
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.

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Pages: 1, 2, 3
Recent Queries:-
  1. script php hide - 6.79 hr back. (1)
  2. how to hide real web address in php - 40.98 hr back. (1)
  3. php hide file link - 43.63 hr back. (1)
  4. images - 44.22 hr back. (1)
  5. would anyone now how i can hide actual url, for example - 44.64 hr back. (1)
  6. php how to hide a input text - 68.57 hr back. (1)
  7. php hiding url script - 98.71 hr back. (1)
  8. realurl hide in menu - 132.01 hr back. (1)
  9. how to disguise url - 139.88 hr back. (1)
  10. hide images folder on website - 165.92 hr back. (1)
  11. how to hide images folder from website - 166.23 hr back. (1)
  12. url images - 187.08 hr back. (1)
  13. get images url code - 195.86 hr back. (1)
  14. how to put image url - 211.63 hr back. (1)
Similar Topics

Keywords : hide, real, url, images, php

  1. Tutorial : Hide Folder Without Any Softwares
    Descriptive enough! (10)
  2. Make A Moderately-secure Password System Using Javascript
    using file redirection to hide the password. (11)
    JavaScript is very handy at making forms, allowing for much more customization and easier ways to
    send data. So making Login forms using JavaScript may seem to many to be a very feasable idea.
    However, JavaScript is very bad at protecting Passwords, as since the passwords are not encypted and
    the whole JavaScript code is in the page, a person could just view the Page Source and find out
    everything. Even if you use an external JavaScript, it would still be poor as the file name for the
    external JavaScript would still be revealed. But I have an answer! There is a relative....
  3. How To Hide Your Important Files And Folders
    In Ms. Windows, Without Using Programmes. (7)
    Most of people share their computers with others -family, mates, buddy or whoever- and that sharing
    threatens their secrets and private file to be revealed, letting some people to know things they
    shouldn't know.. My Securing Way: Operation - Camouflage Use an Icon
    Editor to generate a 1x1 Transparent Icon and Save it .. > 1 Open CMD.. Start >> Run or Press
    WindowsLogo+R.. Lets Say you wanna hide a Folder named " secure " and it's located in
    E:\folder\ so Write E: and Press Enter then Write Cd folder and Enter then Attrib +s +h....
  4. Uploading Images To Phpbb Galleries
    (0)
    This tutorial can be used to show someone how to upload images to a PHPBB Gallerie addon. This
    tutorial is not specific to any particular phpbb mod since all mods will most likely be similar. 1)
    go to the website galleries (easy) (http://www.school-stuff.org/album.php) 2) Click on the category
    that you want to upload the images to. 3) Look for a button that says Upload and click on it. 4)
    Insert a Title in the title box this will be what people can identify the picture by, does not need
    a description. 5) Click on the Browse Button next to 'Upload a picture from ....
  5. Uploading Images To The Trap17 Gallery
    A How To, on uploading images to the trap17 gallery (4)
    Well, seeing as how BuffaloHelp or OpaQue has told us to upload our images to the trap17 gallery
    instead of our own, i figure that i could help out those who dont know how to do it because it
    isn't all that easy for the noobs. Uploading Images To The Trap17 Gallery Step 1:..
    Obviously You need a picture so get one of those Step 2:.. Go to "My Controlls" Step 3:.. Once
    you get there, on the left hand side look for "Invision Gallery" Step 4:.. Click On "Your Albums"
    Step 5:.. Now you need to create an album so click on "Create My First Album" S....
  6. Blending Patterns Onto Images
    blending patterns onto images (2)
    Hmm. I wrote this for a thread, but I decided to submit it here too. First you need to download or
    make the patterns. I have some ready made patterns here:
    http://www.members.lycos.co.uk/boysbr3akhearts/Patterns .You have to save each image in that
    directory, and place them into your Patterns folder (C:\Program Files\Jasc Software Inc\Paint Shop
    Pro 7\Patterns). I made this mini-tutorial in PSP 7, but I don't think it's hard to figure
    out how to do this in other programs. After you have downloaded the patterns. ^ Find that in PSP
    and click the Pattern opti....
  7. Hide Names In Welcome Screen
    in XP (0)
    Annoyed by seeing many User Names in the Welcome Screen you can remove them Some times a user needs
    to be added to access a network resource but the user will not be physically logged in to your
    system. In such cases you can remove his/her name from the WelcomeScreen in Xp to do this go to
    Registry editor as normal go to HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENT
    VERSION\WINLOGON\SPECIALACCOUNTS\USERLIST\ Right click in the empty space in the right pane and
    create a new DWORD value Name this new value "Username" and enter "0" as the data value you are....
  8. Writing On Images
    ...with PHP and GD library (2)
    Demo: http://www.fantastictutorials.com/files/av...er&color=random ..and:
    http://www.fantastictutorials.com/files/avatar/index.php This tutorial is based on the code I used
    for this avatar generator . This tutorial is for people that are reasonably comfortable with
    php. I have went to a lot of work making it as simple as possible so even if you are a beginer you
    shouldn't have problems. After writing the tutorial, I realised how difficult it is to read
    when the source and tutorial seperately ... so I commented the tutorial into the source of the php.
    First....
  9. Making Shadows Without Images
    (4)
    Im going to show you very simply how to create boxes with Shadows using div tags and css, no images
    needed, meaning fat pageload times! /biggrin.gif' border='0' style='vertical-align:middle'
    alt='biggrin.gif' /> You simple need to create two layers, one behind the other, the one behind
    will have a top and left margin on 20px, the one infront 10px, set teh background colour of the one
    behing darker than teh one infront, you should end up with something like this: Here is th html
    to create this effect: CODE Its as simple as that, two divtags, a bit of cs....
  10. How To Resize/host Images!
    Very easy to understand! (15)
    For the tutorial I'm ganna be using IrfanVeiw. It's a freeware image program which you can
    use to resize and add effect to image, and a lot more ofcourse. If you don't have IrfanVeiw you
    can get it from download.com or anyother download site. How to resize images: First you gatta
    open Irfanveiw...gee, how obvious. First, open the picture you wish to resize. Second, click the tab
    that says "Image" -=Example=- Third, click "Resize/Resample -=Example=- Finaly, set the Height
    and Width of the picture to what you want, make sure you have "Set New Size" a....
  11. Extending The Image Preloader With Php4
    Dynamically adds your images to Preloader! (3)
    Tutorial: Extending the Image Preloader with PHP4, by Rob J. Secord, B.Sc. (SystemWisdom)
    Second Tutorial in a Series of 2 Tutorials! Be sure to have read the First One here: "Image
    Preloader With Progress Bar Status" See a working Sample of this Script! (Note: Preloads 100
    images, some images are larger than others, and may take awhile for some people.) Description :
    A Tutorial for Extending the Image Preloader with PHP4 to Dynamically Populate the Array of
    Preloaded Images. This tutorial is the second in a series of 2 tutorials, and assumes that y....
  12. Css Trick: Hide Disabled Internet Explorer Vertical Scrollbar
    (20)
    I'm working on a website and a few minutes ago I got very tired from the Internet Explorer
    vertical scrollbar. This vertical scrollbar is always there, even if the length of the page does not
    require a vertical scrollbar. In this case, Internet Explorer will disable the scrollbar though not
    remove it. In my opinion this would be correct behaviour. The disabled however not hidden scrollbar
    means that a switch between a preview of your website in Mozilla Firefox and MS Internet Explorer
    will lead to an annoying change of the location of your layout. To disable this an....
  13. Roll-over Image Links With Css
    No preloading of images (2)
    Here is a way of having roll over image links without preloading images by using CSS and a table.
    It's very useful for a list of links as in a side bar menu or header. It also solves not having
    to make a seperate image for each different link by placing the desired text over the image. 1.
    First you need an image which comprises of the main link image, the 'mouse over' image link
    underneath plus you can have another for visited links. As for most roll over images, the images
    should be the same size. The above example - button.gif is 100x60px with each lin....
  14. Simple Image Rotator
    randomly rotate images (6)
    First, It's really confusing. Do you know any tutorials on Image Manipulation on PHP?
    Here's another simple one: 1. Create a 5 image. 2. Rename them to something like:
    image1.jpg; image2.jpg; and so on... 3. Create your PHP file (rotation.php) 4. Enter the
    following code: CODE header("content-type: image/jpeg");
    readfile("image".mt_rand(1,3).".jpg"); ?> 5. Execute your script.....

    1. Looking for hide, real, url, images, php

Searching Video's for hide, real, url, images, php




advertisement



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