无为清净楼资源网 Design By www.qnjia.com
你需要修改attachment.php文件 在根目录下
在$attachexists = $ispaid = FALSE;下面添加
if (!empty($checktwo)) {
在最末尾的?>前添加
} else {
echo "<script>alert('写上你要提示的内容')</script>";
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=$PHP_SELF?checktwo=1&aid=$aid\">";
}
我在本机架设Discuz! 5.0.1调试通过了
完整代码如下:
<?php
/*
[Discuz!] (C)2001-2006 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$RCSfile: attachment.php,v $
$Revision: 1.13 $
$Date: 2006/08/11 06:51:07 $
*/
require_once './include/common.inc.php';
$discuz_action = 14;
if($attachrefcheck && $_SERVER['HTTP_REFERER'] && preg_replace("/https?:\/\/([^\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) != $_SERVER['HTTP_HOST']) {
//header("Location: {$boardurl}images/common/invalidreferer.gif");
showmessage('attachment_referer_invalid', NULL, 'HALTED');
}
/*
$query = $db->query("SELECT a.*, t.fid, p.authorid FROM {$tablepre}attachments a, {$tablepre}threads t, {$tablepre}posts p
WHERE a.aid='$aid' AND t.tid=a.tid AND p.pid=a.pid AND t.displayorder>='0' AND p.invisible='0'");
$attach = $db->fetch_array($query);
*/
periodscheck('attachbanperiods');
$attachexists = $ispaid = FALSE;
if (!empty($checktwo)) {
if(!empty($aid)) {
$query = $db->query("SELECT * FROM {$tablepre}attachments WHERE aid='$aid'");
if($attach = $db->fetch_array($query)) {
$query = $db->query("SELECT tid, fid, price, special FROM {$tablepre}threads WHERE tid='$attach[tid]' AND displayorder>='0'");
$thread = $db->fetch_array($query);
if($thread['fid']) {
$query = $db->query("SELECT authorid FROM {$tablepre}posts WHERE pid='$attach[pid]' AND invisible='0'");
if($db->num_rows($query)) {
$attach['authorid'] = $db->result($query, 0);
$attachexists = TRUE;
}
}
}
}
if($allowgetattach && ($attach['readperm'] && $attach['readperm'] > $readaccess) && $adminid <= 0 && !($discuz_uid && $discuz_uid == $attach['authorid'])) {
showmessage('attachment_forum_nopermission', NULL, 'NOPERM');
}
if(!$thread['special'] && $thread['price'] > 0 && (!$discuz_uid || ($discuz_uid && $discuz_uid != $attach['authorid'] && $adminid <=0))) {
$query = $db->query("SELECT uid FROM {$tablepre}paymentlog WHERE uid='$discuz_uid' AND tid='$attach[tid]'");
if($db->result($query, 0)) {
$ispaid = TRUE;
} else {
showmessage('attachment_payto', 'viewthread.php?tid='.$attach['tid']);
}
}
$filename = $attachdir.'/'.$attach['attachment'];
if(is_readable($filename) && $attachexists) {
$query = $db->query("SELECT f.viewperm, f.getattachperm, f.getattachcredits, a.allowgetattach FROM {$tablepre}forumfields f
LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid=f.fid
WHERE f.fid='$thread[fid]'");
$forum = $db->fetch_array($query);
if(!$ispaid) {
if(!$forum['allowgetattach']) {
if(!$forum['getattachperm'] && !$allowgetattach) {
showmessage('group_nopermission', NULL, 'NOPERM');
} elseif(($forum['getattachperm'] && !forumperm($forum['getattachperm'])) || ($forum['viewperm'] && !forumperm($forum['viewperm']))) {
showmessage('attachment_forum_nopermission', NULL, 'NOPERM');
}
}
}
if(!($isimage = preg_match("/^image\/.+/", $attach['filetype']))) {
checklowerlimit($creditspolicy['getattach'], -1);
}
if(empty($noupdate)) {
if($delayviewcount == 2 || $delayviewcount == 3) {
$logfile = './forumdata/cache/cache_attachviews.log';
if(substr($timestamp, -1) == '0') {
require_once DISCUZ_ROOT.'./include/misc.func.php';
updateviews('attachments', 'aid', 'downloads', $logfile);
}
if(@$fp = fopen(DISCUZ_ROOT.$logfile, 'a')) {
fwrite($fp, "$aid\n");
fclose($fp);
} elseif($adminid == 1) {
showmessage('view_log_invalid');
}
} else {
$db->query("UPDATE {$tablepre}attachments SET downloads=downloads+'1' WHERE aid='$aid'", 'UNBUFFERED');
}
}
if(!$isimage) {
$forum['getattachcredits'] = $forum['getattachcredits'] ? unserialize($forum['getattachcredits']) : array();
$getattachcredits = $forum['getattachcredits'] ? $forum['getattachcredits'] : $creditspolicy['getattach'];
updatecredits($discuz_uid, $getattachcredits, -1);
}
$filesize = filesize($filename);
ob_end_clean();
header('Cache-control: max-age=31536000');
header('Expires: '.gmdate('D, d M Y H:i:s', $timestamp + 31536000).' GMT');
header('Content-Encoding: none');
$attach['filename'] = (strtolower($charset) == 'utf-8' && strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE')) ? urlencode($attach['filename']) : $attach['filename'];
if($isimage && !empty($noupdate)) {
header('Content-Disposition: inline; filename='.$attach['filename']);
} else {
header('Content-Disposition: attachment; filename='.$attach['filename']);
}
header('Content-Type: '.$attach['filetype']);
@$fp = fopen($filename, 'rb');
@flock($fp, 2);
$attachment = @fread($fp, $filesize);
@fclose($fp);
echo $attachment;
} else {
showmessage('attachment_nonexistence');
}
} else {
echo "<script>alert('$PHP_SELF')</script>";
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=$PHP_SELF?checktwo=1&aid=$aid\">";
}
?>
在$attachexists = $ispaid = FALSE;下面添加
if (!empty($checktwo)) {
在最末尾的?>前添加
} else {
echo "<script>alert('写上你要提示的内容')</script>";
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=$PHP_SELF?checktwo=1&aid=$aid\">";
}
我在本机架设Discuz! 5.0.1调试通过了
完整代码如下:
<?php
/*
[Discuz!] (C)2001-2006 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$RCSfile: attachment.php,v $
$Revision: 1.13 $
$Date: 2006/08/11 06:51:07 $
*/
require_once './include/common.inc.php';
$discuz_action = 14;
if($attachrefcheck && $_SERVER['HTTP_REFERER'] && preg_replace("/https?:\/\/([^\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) != $_SERVER['HTTP_HOST']) {
//header("Location: {$boardurl}images/common/invalidreferer.gif");
showmessage('attachment_referer_invalid', NULL, 'HALTED');
}
/*
$query = $db->query("SELECT a.*, t.fid, p.authorid FROM {$tablepre}attachments a, {$tablepre}threads t, {$tablepre}posts p
WHERE a.aid='$aid' AND t.tid=a.tid AND p.pid=a.pid AND t.displayorder>='0' AND p.invisible='0'");
$attach = $db->fetch_array($query);
*/
periodscheck('attachbanperiods');
$attachexists = $ispaid = FALSE;
if (!empty($checktwo)) {
if(!empty($aid)) {
$query = $db->query("SELECT * FROM {$tablepre}attachments WHERE aid='$aid'");
if($attach = $db->fetch_array($query)) {
$query = $db->query("SELECT tid, fid, price, special FROM {$tablepre}threads WHERE tid='$attach[tid]' AND displayorder>='0'");
$thread = $db->fetch_array($query);
if($thread['fid']) {
$query = $db->query("SELECT authorid FROM {$tablepre}posts WHERE pid='$attach[pid]' AND invisible='0'");
if($db->num_rows($query)) {
$attach['authorid'] = $db->result($query, 0);
$attachexists = TRUE;
}
}
}
}
if($allowgetattach && ($attach['readperm'] && $attach['readperm'] > $readaccess) && $adminid <= 0 && !($discuz_uid && $discuz_uid == $attach['authorid'])) {
showmessage('attachment_forum_nopermission', NULL, 'NOPERM');
}
if(!$thread['special'] && $thread['price'] > 0 && (!$discuz_uid || ($discuz_uid && $discuz_uid != $attach['authorid'] && $adminid <=0))) {
$query = $db->query("SELECT uid FROM {$tablepre}paymentlog WHERE uid='$discuz_uid' AND tid='$attach[tid]'");
if($db->result($query, 0)) {
$ispaid = TRUE;
} else {
showmessage('attachment_payto', 'viewthread.php?tid='.$attach['tid']);
}
}
$filename = $attachdir.'/'.$attach['attachment'];
if(is_readable($filename) && $attachexists) {
$query = $db->query("SELECT f.viewperm, f.getattachperm, f.getattachcredits, a.allowgetattach FROM {$tablepre}forumfields f
LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid=f.fid
WHERE f.fid='$thread[fid]'");
$forum = $db->fetch_array($query);
if(!$ispaid) {
if(!$forum['allowgetattach']) {
if(!$forum['getattachperm'] && !$allowgetattach) {
showmessage('group_nopermission', NULL, 'NOPERM');
} elseif(($forum['getattachperm'] && !forumperm($forum['getattachperm'])) || ($forum['viewperm'] && !forumperm($forum['viewperm']))) {
showmessage('attachment_forum_nopermission', NULL, 'NOPERM');
}
}
}
if(!($isimage = preg_match("/^image\/.+/", $attach['filetype']))) {
checklowerlimit($creditspolicy['getattach'], -1);
}
if(empty($noupdate)) {
if($delayviewcount == 2 || $delayviewcount == 3) {
$logfile = './forumdata/cache/cache_attachviews.log';
if(substr($timestamp, -1) == '0') {
require_once DISCUZ_ROOT.'./include/misc.func.php';
updateviews('attachments', 'aid', 'downloads', $logfile);
}
if(@$fp = fopen(DISCUZ_ROOT.$logfile, 'a')) {
fwrite($fp, "$aid\n");
fclose($fp);
} elseif($adminid == 1) {
showmessage('view_log_invalid');
}
} else {
$db->query("UPDATE {$tablepre}attachments SET downloads=downloads+'1' WHERE aid='$aid'", 'UNBUFFERED');
}
}
if(!$isimage) {
$forum['getattachcredits'] = $forum['getattachcredits'] ? unserialize($forum['getattachcredits']) : array();
$getattachcredits = $forum['getattachcredits'] ? $forum['getattachcredits'] : $creditspolicy['getattach'];
updatecredits($discuz_uid, $getattachcredits, -1);
}
$filesize = filesize($filename);
ob_end_clean();
header('Cache-control: max-age=31536000');
header('Expires: '.gmdate('D, d M Y H:i:s', $timestamp + 31536000).' GMT');
header('Content-Encoding: none');
$attach['filename'] = (strtolower($charset) == 'utf-8' && strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE')) ? urlencode($attach['filename']) : $attach['filename'];
if($isimage && !empty($noupdate)) {
header('Content-Disposition: inline; filename='.$attach['filename']);
} else {
header('Content-Disposition: attachment; filename='.$attach['filename']);
}
header('Content-Type: '.$attach['filetype']);
@$fp = fopen($filename, 'rb');
@flock($fp, 2);
$attachment = @fread($fp, $filesize);
@fclose($fp);
echo $attachment;
} else {
showmessage('attachment_nonexistence');
}
} else {
echo "<script>alert('$PHP_SELF')</script>";
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=$PHP_SELF?checktwo=1&aid=$aid\">";
}
?>
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
更新日志
2024年11月15日
2024年11月15日
- 孙露《一抹伤HQ》头版限量[WAV+CUE][1G]
- 黄安.1989-一切从头(TP版)【天际唱片】【FLAC分轨】
- 群星.1994-浓情蜜意情歌精丫华纳】【WAV+CUE】
- 邓丽君.1983-淡淡幽情(2022环球MQA-UHQCD限量版)【环球】【WAV+CUE】
- 试音天碟《专业测试第一天碟》经典天碟精选[WAV分轨][1G]
- 试音典范 《情惹发烧情HQCD》人声发烧极品 [WAV+CUE][1G]
- 世界顶级汽车音响试音王《幸福在路上》[低速原抓WAV+CUE][1.1G]
- 老头杯第二届什么时候开始 英雄联盟第二届老头杯开赛时间介绍
- 老头杯第二届什么时候结束 英雄联盟第二届老头杯结束时间介绍
- 老头杯第二届规则是什么 英雄联盟老头杯第二届规则介绍
- 王崴-爵士听堂.蓝色波萨(HQCD)[WAV+CUE]
- 群星《欧美动听情歌·柔情第5季》2CD【DTS-WAV分轨】
- [极品珍藏]德意志进行曲集卡拉扬SACD[WAV+CUE]
- 前暴雪制作人呼吁反击DEI 玩家:夺回文化!
- 腾讯证实子公司Sharkmob大规模裁员:整个市场很低迷