Please wait while we load your page...
 

Announcements

NoHotlink

More Tools. . .

\
We provide this tool for FREE! However, we would greatly appreciate your support so we can continue to develop more tools (online tools and downloadable tools). You can show your support by sharing / liking this tool on Facebook. You can also tweet this page to your Twitter followers and following us on Twitter.


What is hotlinking? Hotlinking (= bandwidth and intellectual property theft) refers to direct linking to a website's files (images, video, etc.). An example would be using an <img> HTML tag to display an image you found on someone else's webpage so it will appear on your own website, blog, forum message, etc. The most common solution is to add Rewrite lines to .htaccess file in images directory to check Referer. Only display images if referer is from certain domains. Old school, ineffective, and easy to cheat. For one, it is common for browsers to not pass referer (for example, under certain browser privacy settings, and when viewing site as HTTPS). Referer can also be faked or spoofed. Unreliable. This tool serves to block hotlinking of images without referer checking.

You need to create two(2) files: (1) a page to display the image, and (2) a PHP file (image.php) to serve the image.

image.php


<?php
define("SURL", "http://www.yoursite.com/");
session_start();
if ($_SESSION['imagesess']) {
	$img	= $_GET['img'];
	$exts	= array('bmp' => 'image/bmp', 'gif' => 'image/gif','jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'png' => 'image/png');
	$ext	= substr($img, strrpos($img, '.') + 1);
	if (key_exists($ext, $exts)) {
		$mime	= $exts[$ext];
		$url	= SURL . base64_decode($_SESSION['imagesess']) . $img;
		header("Content-type: $mime");
		echo @file_get_contents($url);
	}
}
?>


Password Sentry NoHotlinkChange "http://www.yoursite.com/" in line 02 to reflect base URL of your site.

index.php


<?php
session_start();
$_SESSION['imagesess']	= base64_decode('/img/');
?>
<html>
<head>
<title></title>
<style type="text/css">
.image {
	float:		left;
	overflow:	hidden;
	position:	relative;
}
.image .overlay, .image .overlay img {
	height:		100%;
	left:		0px;
	position:	absolute;
	top:		0px;
	width:		100%;
}
</style>
</head>
<body>
<div class="image">
	<img src="/image.php?img=image.jpg" alt="" />
	<div class="overlay">
		<img src="overlay.gif" alt="" />
	</div>
</div>
</body>
</html>


Password Sentry NoHotlinkChange '/img/' in line 03 to reflect relative URL to images directory where you are linking to an image.
Password Sentry NoHotlinkChange "/image.php?img=image.jpg" in line 25 to reflect URL to image.php, and image name.
Password Sentry NoHotlinkChange "overlay.gif" in line 27 to reflect URL to overlay.gif. Download the file below.
Password Sentry NoHotlinkRather use a HTML page instead of a PHP one? Easy solution. Rename index.php as index.html. Then, in the same directory as the file, create a .htaccess file if it does not already exists. Then add the following lines to the .htaccess file:

<Files index.html>
SetHandler application/x-httpd-php
</Files>


overlay.gif


Download overlay.gif file

Demo












Live Chat Not Available