Home > Backend Development > PHP Tutorial > PHP crack anti-hotlink image function_PHP tutorial

PHP crack anti-hotlink image function_PHP tutorial

WBOY
Release: 2016-07-21 15:48:34
Original
784 people have browsed it

Copy code The code is as follows:

$url=$_GET['url'];
$ext=pathinfo($url,PATHINFO_EXTENSION);
if($ext!='jpg' && $ext!='gif'){ // Only jpg and gif are supported
readfile('/ upload/20081209130557536.gif');
exit;
}
$file=md5($url).'.'.$ext;
if(file_exists($file)){
readfile($file);
exit;
}else{
$data=file_get_contents($url);
if(!$data){ // Failed to read
readfile( '/upload/20081209130557536.gif');
exit;
}
$handle=fopen($file,'wb');
fwrite($handle,$data);
fclose($handle);
echo $data;
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319698.htmlTechArticleCopy the code as follows: ?php $url=$_GET['url']; $ext=pathinfo($ url,PATHINFO_EXTENSION); if($ext!='jpg' $ext!='gif'){ // Only supports jpg and gif readfile('/upload/20081209130557536.gi...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template