php 破解防盗链图片函数

2015-01-24信息快讯网

只支持jpg和gif ,大家可以修改下,就可以支持多种图片格式了

<?php 
$url=$_GET['url']; 
$ext=pathinfo($url,PATHINFO_EXTENSION); 
if($ext!='jpg' && $ext!='gif'){ // 只支持jpg和gif 
readfile('/upload/20081209130557536.gif'); 
exit; 
} 
$file=md5($url).'.'.$ext; 
if(file_exists($file)){ 
readfile($file); 
exit; 
}else{ 
$data=file_get_contents($url); 
if(!$data){ // 读取失败 
readfile('/upload/20081209130557536.gif'); 
exit; 
} 
$handle=fopen($file,'wb'); 
fwrite($handle,$data); 
fclose($handle); 
echo $data; 
} 
?>

php简单提示框alert封装函数
为IP查询添加GOOGLE地图功能的代码
Google Voice 短信发送接口PHP开源版(2010.5更新)
PHP中文URL编解码(urlencode()rawurlencode()
用PHP为SHOPEX增加日志功能代码
php操作excel文件 基于phpexcel
PHP extract 将数组拆分成多个变量的函数
PHP similar_text 字符串的相似性比较函数
php 提速工具eAccelerator 配置参数详解
php file_exists 检查文件或目录是否存在的函数
php is_file 判断给定文件名是否为一个正常的文件
PHP中冒号、endif、endwhile、endfor使用介绍
php file_get_contents函数轻松采集html数据
PHP正则的Unknown Modifier错误解决方法
php is_file()和is_dir()用于遍历目录时用法注意事项
Search File Contents PHP 搜索目录文本内容的代码
PHP setcookie() cannot modify header information 的解决方法
php escape URL编码
中英文字符串翻转函数
Zend Studio for Eclipse的java.lang.NullPointerException错误的解决方法
PHPMailer安装方法及简单实例
PHP syntax error, unexpected $end 错误的一种原因及解决
Cannot modify header information错误解决方法
使用eAccelerator加密PHP程序
FleaPHP的安全设置方法
用PHP调用Oracle存储过程的方法
PHPMailer邮件类利用smtp.163.com发送邮件方法
PHP Smarty生成EXCEL文档的代码
PHP 得到根目录的 __FILE__ 常量
Excel数据导入Mysql数据库的实现代码
php格式化工具Beautify PHP小小BUG
PHP中的extract的作用分析
php出现Cannot modify header information问题的解决方法大全
深思 PHP 数组遍历的差异(array_diff 的实现)
由php if 想到的些问题
PHP 中dirname(_file_)讲解
PHP 的 __FILE__ 常量
©2014-2024 dbsqp.com