Ok, I have just installed the chimage.php script to one of my directories to prevent bandwidth stealing, and now I want to see if I can have it modified to do more. Here is the original script
(everything before this paste is just my configurations)
// --- YOU NEED NOT MODIFY ANYTHING AFTER THIS LINE ---
function isreferrerokay ( $referrer, $validprefixes )
{
$validreferrer = 0 ;
$authreferrer = current( $validprefixes );
while ($authreferrer) {
if (eregi( "https?://$authreferrer/", $referrer )) {
$validreferrer = 1 ;
break ;
}
$authreferrer = next( $validprefixes );
}
return $validreferrer ;
}
//----------------------- main program -----------------------
$image = $_GET['image'] ;
$referrer = getenv( "HTTP_REFERER" );
if (isset($_GET['image'])) {
if (empty($referrer) ||
isreferrerokay( $referrer, $validprefixes )) {
$imagepath = $imagedir . $image ;
$imageinfo = getimagesize( $imagepath );
if ($imageinfo[2] == 1) {
$imagetype = "gif" ;
}
elseif ($imageinfo[2] == 2) {
$imagetype = "jpeg" ;
}
elseif ($imageinfo[2] == 3) {
$imagetype = "png" ;
}
else {
header( "HTTP/1.0 404 Not Found" );
exit ;
}
header( "Content-type: image/$imagetype" );
@readfile( $imagepath );
}
else {
if (isset($email)) {
mail( $email, "Bandwidth Theft Alert",
"WARNING:\n\n$referrer\ntried to access\n$image\n",
"From: CHImageGuard <$email>" );
}
header( "HTTP/1.0 404 Not Found" );
}
}
else {
header( "Location: $homepage" );
}
?>
Now, what this does so far is do a callup from the specified directory and displays the image on the screen where its supposed to. What I want it to do now is to not only call up images from a remote directory that the user cant see, but I also want it to do is not allow the image to be save. I know that as long as people can see source code and blah blah, but I want the code to be able to save either an alternate image of my choosing, or a blank html file, instead of still being able to save the called up image. Probably a simple modification, but my lack of php skills wont get me far. Does anybody know how to make this change to the code?? All help is greatly appreciated, and if you have a paypal account, possibly rewarded.