Hello, For some unknown reason my image protecting script doesn't work... Wan i calling image from html who is in same directory witch script its just displays nothing (no redirection, no image, nothing!). Any ideas whats wrong? Thanks. <?php // This script can watermark image, hide real image patch, and prevent hotlinking to images. // originally what script is named img.php. you can rename it. // call this script with an image tag // <img src="script.php?imageurl"> where imageurl is a relative path such as subdirectory/image.jpg //____________WEBSITES ALLOWED TO LINK TO IMAGES____________________ // Do not put any trailing slashes ("/") nor any "http://" prefixes. // If your webpage can be viewed witch www. and witeout, put both urls. $validprefixes = array ( "something.com", "www.something.com" ) ; //____________REDIRECTION___________________________________________ // If visitor will try to access what file, where he will be redirected? $homepage = "www.something.com" ; //____________IMAGE PATH____________________________________________ //image path used to hide real image url. // Here how it works: script will add imgpath to text you entered in image url. // For example: if your tag is <img src="scriptame.php?imageurl.png"> // and imagepath is img/ , the real image path will be img/imageurl.png . // In image path you can also enter webpage. $imgpath = "image/"; //____________WATERMARK____________________________________________ //image what will be used as watermark. //watermark must be larger wan images who will be watermarked. $watermarkPath = "watermark.gif" ; //Enter watermark displaying strength from 100 till 0. //Note: if it will be 0 no watermark will be added. $watermarkstrength = "25"; //____________END OF CONFIGURATION__________________________________ function isreferrerokay ( $referrer, $validprefixes ) { $validreferrer = 0 ; $authreferrer = current( $validprefixes ); while ($authreferrer) { if (eregi( "^https?://$authreferrer/", $referrer )) { $validreferrer = 1 ; break ; } $authreferrer = next( $validprefixes ); } return $validreferrer ; } $img = $_SERVER['QUERY_STRING'] ; $imgurl = $imgpath . $img ; $referrer = getenv( "HTTP_REFERER" ); if (isset($_SERVER['QUERY_STRING'])) { if (empty($referrer) || isreferrerokay( $referrer, $validprefixes )) { $filetype = substr($imgurl,strlen($imgurl)-4,4); $filetype = strtolower($filetype) ; $watermarkType = substr($watermarkPath,strlen($watermarkPath)-4,4); $watermarkType = strtolower($watermarkType); if($filetype == ".gif") $image = @imagecreatefromgif($imgurl); else if($filetype == ".jpg" || $filetype == "jpeg") $image = @imagecreatefromjpeg($imgurl) ; else if($filetype == ".png") $image = @imagecreatefrompng($imgurl) ; else die(); if(!$image) die(); if($watermarkType == ".gif") $watermark = @imagecreatefromgif($watermarkPath); else if($watermarkType == ".png") $watermark = @imagecreatefrompng($watermarkPath); else die(); if(!$watermark) die(); $imagewidth = imagesx($image); $imageheight = imagesy($image); $watermarkwidth = imagesx($watermark); $watermarkheight = imagesy($watermark); $startwidth = ($imagewidth - $imagewidth); $startheight = ($imageheight - $imageheight); imagecopymerge($image, $watermark, $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight, $watermarkstrength); imagejpeg($image); imagedestroy($image); imagedestroy($watermark); } else { //if (isset($email)) { //mail( $email, "Bandwidth Theft Alert", //"WARNING:\n\n$referrer\ntried to access\n$image\n", //"From: IMGProtection <$email>" ); //} header( "HTTP/1.0 404 Not Found" ); } } else { header( "Location: $homepage" ); } ?> PHP: