开源技术促进联盟 »
人性化修改--单贴附件个数限制 for dz600
发布人:lulu 时间:2008-1-11 18:32 来源: Php Question 查看: 583次
在
[php] if(empty($attachments)) {
return FALSE;
}[/php]
下面加上
[php] $setmaxnums = 10; //设置最大值
$attachmentnums = count($attachments) - 2;
$postattachmsg = '';
if($attachmentnums > $setmaxnums) {
$postattachmsg = "一个帖子内只允许发 $setmaxnums 个附件。请返回修改。";
}else if ($attachmentnums > 0 && $GLOBALS['pid']) {
if($db->result($db->query("SELECT count(*) FROM {$tablepre}attachments WHERE pid='$GLOBALS[pid]'"), 0) > $setmaxnums - $attachmentnums) {
$postattachmsg = "一个帖子内只允许发 $setmaxnums 个附件。请返回修改。";
}
}
$postattachmsg && showmessage($postattachmsg);[/php]
./include/javascript/post_attach.js
在
CODE:
function addAttach() {下面加上
CODE:
if(aid-1 > 10) {
alert('一个帖子最大上传10个附件');
delAttach(aid-1);
return false;
}okps: dz上发的不知道谁给我删了。




文章评论
共有 3 位PhpQ的网友发表了评论查看完整内容