When we need to call other site pictures, other site pictures often show a not displayed, but in a separate browser access, but it can.
Php
Simulate Reffer hack to prevent stolen images
<?php
error_reporting (0);
$HOST = "java-er.com";
Require ' class/db.php ';
Header ("Content-type:image/png");
$id = $_get["id"];
$sql = "SELECT * from blog where id= $id";
$row = $db->queryrow ($sql);
$url = $row ["url"];
The read out URL for http://www.sina.com.cn/aaad.html will act as a reffer
$imgurl = $_get["url"];
Extract image Domain
$domain = Preg_replace ("/^http:\/\/" (. +?) \/.+?$/"," $ ", $imgurl);
Compatible with the original site like/2.jpg
if ($url = = "") {
$url = $imgurl;
}
if (!preg_match ("/^http:\/\/.*?$/", $imgurl)) {
$domain = $HOST;
$imgurl = "http://". $HOST. " /". $imgurl;
$url = $imgurl;
}
Compatible with the original web end
image.58.com/showphone.aspx?t=v55&v=0926dc20fe0c323bh29559c838d7cb65e
$fp = Fsockopen ("$domain", $errno, $errstr, 30);
if (! $fp) {
echo "ERR: $errstr ($errno) <br/>\n";
} else {
$out = "Get $imgurl http/1.1\r\n";
$out = "get/http/1.1\r\n";
$out. = "accept:*/*\r\n";
$out. = "Host: $domain \ r \ n";
$out. = "Referer: $url \ r \ n";
$out. = "connection:close\r\n\r\n";
$str = "";
Fwrite ($fp, $out);
while (!feof ($fp)) {
$str. =fgets ($FP, 128);
}
$str = Trimheader ($STR);
Echo $str;
Fclose ($FP);
}
function Trimheader ($content) {
$array =split ("\r\n\r\n", $content);
return $array [1];
}
?>
Automatically replace your Web page when you enter the contents of a picture
$c = Preg_replace ("//is", "If you are a technician can add me QQ 2651-0442-02, if you are Java technology people can also join QQ group 1784-9136-0
Starting address: Monthly Small Rise blog-