Anti Image Protection Script

banabot

Newbie
Joined
Jan 2, 2010
Messages
5
Reaction score
0
Hi,
with this script you can include images form refere protected sites (http://www.yourhtmlsource.com/sitemanagement/bandwidththeft.html).

PHP:
<?php
$url = $_GET['img'];
$urex = "^(https?|ftp)\:\/\/([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)*(\:[0-9]{2,5})?(\/([a-z0-9+\$_-]\.?)+)*\/?(\?[a-z+&\$_.-][a-z0-9;:@/&%=+\$_.-]*)?(#[a-z_.-][a-z0-9+\$_.-]*)?\$";
if (!eregi($urex, $url)) {print 'invalid image'; exit;}
$userAgent = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)';
$ref = explode('/', $url);
$ref = 'http://'.$ref[2].'/';
$ch = curl_init();  
curl_setopt($ch,CURLOPT_REFERER, $ref);
curl_setopt($ch, CURLOPT_URL, $url);  
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);  
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
$image = curl_exec ($ch);  
curl_close ($ch);
header('Content-Type: image');
print $image;
?>

PHP:
without script: <img src="http://www.test.com/image.jpg">
with script: <img src="image-stealer.php?img=http://www.test.com/image.jpg">


Have fun.
 
And waste both bandwidth and resouces too lool. Why don't you download the image to local folder instead?
 
Sorry that I answer so late. Last year I coded an (adult) image grabber. For that this was the better way because the images are only needed for one visitor.
 
Yeah, it's good just in case you use it only in your tool. Imagine you have 1000 visitors at the same time, this script will kill your server.
 
Agreed with youngguy, this script will kill your server. It's better using .htaccess to protect hotlinking images.
 
Back
Top