Notice (8): file_put_contents(): Write of 274 bytes failed with errno=28 No space left on device [CORE/src/Log/Engine/FileLog.php, line 140]

Notice: file_put_contents() [function.file-put-contents]: Write of 1108 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): SplFileObject::fwrite() [<a href='https://secure.php.net/splfileobject.fwrite'>splfileobject.fwrite</a>]: Write of 4220 bytes failed with errno=28 No space left on device [CORE/src/Cache/Engine/FileEngine.php, line 141]

Notice: file_put_contents() [function.file-put-contents]: Write of 2792 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (512): long cache was unable to write 'b779797db03ac982f1f2575f6a2160ad' to Cake\Cache\Engine\FileEngine cache [CORE/src/Cache/Cache.php, line 275]

Notice: file_put_contents() [function.file-put-contents]: Write of 2586 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): SplFileObject::fwrite() [<a href='https://secure.php.net/splfileobject.fwrite'>splfileobject.fwrite</a>]: Write of 168 bytes failed with errno=28 No space left on device [CORE/src/Cache/Engine/FileEngine.php, line 141]

Notice: file_put_contents() [function.file-put-contents]: Write of 2791 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (512): long cache was unable to write 'd010b8de0b90abf688c8ce834bd3a2f6' to Cake\Cache\Engine\FileEngine cache [CORE/src/Cache/Cache.php, line 275]

Notice: file_put_contents() [function.file-put-contents]: Write of 2586 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): SplFileObject::fwrite() [<a href='https://secure.php.net/splfileobject.fwrite'>splfileobject.fwrite</a>]: Write of 118 bytes failed with errno=28 No space left on device [CORE/src/Cache/Engine/FileEngine.php, line 141]

Notice: file_put_contents() [function.file-put-contents]: Write of 2791 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (512): long cache was unable to write 'f30632c6e1a849efb5a834f45cb6d98a' to Cake\Cache\Engine\FileEngine cache [CORE/src/Cache/Cache.php, line 275]

Notice: file_put_contents() [function.file-put-contents]: Write of 2586 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
php防盗链的常用方法小结 - 站长搜索
首页 > 资讯列表 > 编程/数据库 >> PHP

php防盗链的常用方法小结

PHP 2014-12-07 02:57:04 转载来源: 网络整理/侵权必删

本文为大家总结了一些php实现的防盗链功能,感兴趣的同学参考下。 1.简单防盗链 $ADMIN[defaulturl] = "http://domain.net/404.htm";//盗链返回的地址 $okaysites = array("http://domain.net/","http://www.domain.net"); //白名单 $ADMIN[url_1] = "http://domain.net/temp/download/";//下载地点1 $ADMIN[url_2] = "";//下载地点2,以此类推 $reffer = $HTTP_REFERER; if($reffer) { $yes = 0; while(list($domain, $subarray) = each($okaysites)) { if (ereg($subarray,"$reffer")) { $yes = 1; } } $the

本文为大家总结了一些php实现的防盗链功能,感兴趣的同学参考下。


1.简单防盗链


$ADMIN[defaulturl] = "http://domain.net/404.htm";//盗链返回的地址
$okaysites = array("http://domain.net/","http://www.domain.net"); //白名单
$ADMIN[url_1] = "http://domain.net/temp/download/";//下载地点1
$ADMIN[url_2] = "";//下载地点2,以此类推

$reffer = $HTTP_REFERER;
if($reffer) {
$yes = 0;
while(list($domain, $subarray) = each($okaysites)) {
if (ereg($subarray,"$reffer")) {
$yes = 1;
}
}
$theu = "url"."_"."$site";
if ($ADMIN[$theu] AND $yes == 1) {
header("Location: $ADMIN[$theu]/$file");
} else {
header("Location: $ADMIN[defaulturl]");
}
} else {
header("Location: $ADMIN[defaulturl]");
}

?>


使用方法:将上述代码保存为dao4.php,
比如我测试用的validatecode.rar在我的站点http://domain.com/temp/download里面,
则用以下代码表示下载连接.


CODE: [Copy to clipboard]
文件名?site=1&file=文件

2.服务器防盗链
用到iis防盗链软件,可以搜下,网上有很多。s.domain.net里面有的下

3.软件下载的防盗链方法


//放置下载软件的根目录相对于当前脚本目录的相对目录
$fileRelPath = "../../software";
//例外允许连接的网址,注意:自身域名不需要填入,设定为肯定可以下载,
// 空字符串("")表示直接输入网址下载的情况
$excludeReferArr = array("www.domain.net", "domain.net");

chdir($fileRelPath);
$fileRootPath = getcwd() ."/";

$filePath=$HTTP_GET_VARS["file"];

$url=parse_url($_SERVER["HTTP_REFERER"]);

if($url[host]!=$_SERVER["HTTP_HOST"] && !in_array($referHost, $excludeReferArr)){
?>

 

 


标签: php 防盗 常用 方法 小结


声明:本文内容来源自网络,文字、图片等素材版权属于原作者,平台转载素材出于传递更多信息,文章内容仅供参考与学习,切勿作为商业目的使用。如果侵害了您的合法权益,请您及时与我们联系,我们会在第一时间进行处理!我们尊重版权,也致力于保护版权,站搜网感谢您的分享!

站长搜索

http://www.adminso.com

Copyright @ 2007~2024 All Rights Reserved.

Powered By 站长搜索

打开手机扫描上面的二维码打开手机版


使用手机软件扫描微信二维码

关注我们可获取更多热点资讯

站长搜索目录系统技术支持