electriic ink
Jul 14 2005, 06:30 PM
Hiding The Real URL To Your ImagesUsing php to protect the real url to your imagesIn this tutorial I will explain how you can easily hide the real .gif or .jpg url to your images by masking it with php. This is not hard to do. A basic amount of php knowledge is required for this tutorial. Note: This will not protect your images for content robbers. 1. Create a new php file and save it as img.php in the public_html directory 2. Add the following code to img.php. All important notes and information are explained in the remming. CODE
<?
$ext = $_REQUEST["type"]; $filename = $_REQUEST["fl"];
/* $img is the directory where all your images are stored */
$img = "images/";
/* Firstly let's see if the variables have information in them */
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;
}
/* Extensions should be shown as numbers in the url for good protection. We will now redefine $ext matching the appropiate number from requested variable "type" */
if ($ext == 1) {
$ext = "jpg";
} else if ($ext == 2) {
$ext = "gif";
} else if ($ext == 3) {
$ext = "png";
}
/* The filename is not shown as numbers so we now have the "ingredients" needed to show the image. Now lets see if the image exists */
if (!file_exists($img . $filename . "." . $ext)) {
echo "Could not find image";
exit;
}
/* Now lets show the image. This is just a simple include statement */
include $img . $filename . "." . $ext;
?>
3. Change the image urls on your webpages to look like the following CODE <img src="/img.php?fl=filename&type=1" alt="Image"> If you want to download the code, attached is a text file displaying all of this. And that's really all there is to it. Enjoy your php images Click to view attachment
Reply
wariorpk
Jul 14 2005, 06:50 PM
Wow that is a very useful script. Whenever I am about to post an image on my site alot of times I don't want my images hotlinked because of bandwidth.
Reply
truefusion
Jul 14 2005, 07:32 PM
QUOTE(wariorpk @ Jul 14 2005, 02:50 PM) Whenever I am about to post an image on my site alot of times I don't want my images hotlinked because of bandwidth.
Well, you could disable hot linking for images.
Reply
s2city
Jul 15 2005, 05:01 AM
QUOTE(wariorpk @ Jul 14 2005, 02:50 PM) Wow that is a very useful script. Whenever I am about to post an image on my site alot of times I don't want my images hotlinked because of bandwidth. This would still allow your image to be hotlinked... it'd just disguise the URL. Most forums don't allow dynamic urls, so it couldn't be posted... but would work fine in coded html.
Reply
GM-University
Jul 15 2005, 05:47 AM
Kudos cmatmeXtra, you could really make a script like that big... You could release it on Source Forge, it would be quite popular, excelant work...
Reply
electriic ink
Jul 15 2005, 06:40 AM
QUOTE(GM-University @ Jul 15 2005, 06:47 AM) Kudos cmatmeXtra, you could really make a script like that big... You could release it on Source Forge, it would be quite popular, excelant work...  Thanks. I sent the script up to hotscripts several hours back now. Just awaiting their confirmation
Reply
eXtreme
Jul 15 2005, 01:40 PM
Indeed, great PHP script. It's a useful way to put away lots of people who could hotlink the images. Oh, and good luck with it on hotscripts.
Reply
bjrn
Jul 21 2005, 06:14 PM
Neat trick, it really is. But as cmatcmextra pointed out, this is not to prevent content robbing. And if you are worried about hotlinking, your Trap17 hosting cPanel has nice options for hotlinking prevention. But it's still a good example of how you can mask a file, or just put something between the "getter" and the file. I was wondering about one thing, will this affect the caching of images on your webpages? I can imagine that a browser might say "wow, a dynamically generated page, I won't cache it". Which means quite an increce in bandwidth usage if you have a graphics-heavy site.
Reply
Saint_Michael
Jul 22 2005, 01:22 AM
not bad but another way to prevent people from hijacking your images do what ign.com doest, water mark it, but this could be a useful script hopefully its gets downloaded alot.
Reply
xenosaga
Jul 26 2005, 06:40 AM
Wow, thanx man. It's very useful. Indeed. I hate them who stealling my picture. Now with this tutorial it seems I can give an extra protection to my pictures.
Reply
thebluekirby
Oct 2 2005, 02:39 AM
wow, I had no clue a script like this even existed XD awesome, i'll probably use it!!!
Reply
mendezgarcia
Oct 1 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.
Reply
xJedix
Oct 1 2005, 06:20 PM
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  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:
- 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.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  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
Reply
electriic ink
Oct 1 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  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: - 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.
Reply
sxyloverboy
Oct 1 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.
Reply
Recent Queries:--
image click hide url - 3.71 hr back. (1)
-
php download hide url - 8.18 hr back. (1)
-
php image script hide - 8.51 hr back. (1)
-
how to hide a url in php - 9.18 hr back. (1)
-
hide image in php - 11.84 hr back. (1)
-
hide url status bar using php - 13.90 hr back. (1)
-
php hide url - 16.98 hr back. (1)
-
redirect php hide variables - 17.45 hr back. (1)
-
how to hide url in page - 19.91 hr back. (1)
-
php hide password in url - 25.20 hr back. (1)
-
hide image location using on right click - 33.57 hr back. (1)
-
hide url in php - 35.77 hr back. (1)
-
hide get variables in url - 36.46 hr back. (1)
-
hide filename in php - 48.91 hr back. (1)
Similar Topics
Keywords : hide, real, url, images, php
- Tutorial : Hide Folder Without Any Softwares
Descriptive enough! (10)
Make A Moderately-secure Password System Using Javascript
using file redirection to hide the password. (4) 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 rela....
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 At....
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 ....
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....
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 cl....
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"....
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....
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 <div id="Layer1" style="position:....
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....
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 assume....
Css Trick: Hide Disabled Internet Explorer Vertical Scrollbar
(18) 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....
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....
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 <?php header("content-type: image/jpeg");
readfile("image".mt_rand(1,3).".jpg"); ?> 5. Execute your
script.....
Looking for hide, real, url, images, php
|
|
Searching Video's for hide, real, url, images, php
|
advertisement
|
|