Hiding image url script

Started on the old forum in August 2015 · view the original in the archive · old links redirect here

9 replies · 292 views · started 11 years ago · 1 min read

8 participants
Android404 Junior · 15 posts #1

Ok, i came up with something small.

I will be taking it further, and brain storm on doing sql queries within the file, so that it can be used in gallery etc as well.

Main reason for creating this little code was to hide the image url, because i don't want people to even know that such directory exists.

hope you can find other uses for it as well.

Just look at the example.

If you do any mods on it, please repost here.

Thank you

image.php

<?php
$image="path/to/quintins/file/image.jpg";
header("Content-type: image/gif");
echo  file_get_contents("$image");
?>

Usege:

<img src="image.php" alt="Loading..." />

Ok boys, so as i said, it hides the url. Also when you try and download the file, it will save it as php file which just shows a load of nonsense in the file. You get where i'm coming from?

Enjoy

thunderwap Developer · 169 posts #2

I would prefer to disable right click.

WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

GumSlone Administrator Principal · 1,690 posts #3

thunderwap wrote: I would prefer to disable right click.

the code from Android404 is more professional, so that no one can find out the real location/path of the image, disabling right click works only for amateurs, people who don't know how to inspect the html code of your site with developer tools.

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

Android404 Junior · 15 posts #4

I prefer using php, call me old school, but i don't think javascript and old cellphones work together, you could use another ultirnative, but i prefer to avoid javascript all together when it comes to mobile websites all together.

Our newer phones all support javascript, but in my line of business i also focus on compatability.

something else Fellow · 2,296 posts #5

Old school phones just ignore the javascript if its not compatible, although disabling right click is pointless as user can just disable javascript. Although this way of hiding the source of the file it doesn't stop people hotlinking - and also if they do hotlink then it uses more cpu.

People often make the mistake of also including the name of the file in the url eg: image.php?file=TrollFace.jpg A hacker can then use this to their advantage and change the url to something like this: image.php?file=../../index.php Yes you can download the victims full script

A better way of doing it is a call to the database to get a unique identifier instead eg: image.php?file=4216228 or alternatively Stop directory manipulation

ACIDCORE Junior · 30 posts #6

There are several ways to hide the url of the image. You can also put your image directory outside root/public html. use phpthumb etc..etc.. to retrieve the file..just use proper restrictions to prevent exploits.

wapxtech Developer · 189 posts #7

GumSlone wrote: the code from Android404 is more professional, so that no one can find out the real location/path of the image, disabling right click works only for amateurs, people who don't know how to inspect the html code of your site with developer tools.

I second the motion.. in addition, I encode all get functions in my script

External image (may be gone) http://wapx.amob.com Applications, Games, Wallpapers, Ringtones, Videos, Themes, Screensaver and More!!!

centi Developer · 159 posts #8

very nice.... 👍👍

😳 .................................... http://photomag.lk/ .................................... 🤨

tupac Developer · 95 posts #10

I also think it's a great script good layout go for it bro and secure

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close