人性化修改--单贴附件个数限制 for dz600

发布人:lulu  时间:2008-1-11 18:32  来源: Php Question  查看: 583次
include/post.func.php




[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;               
        }
ok


ps: dz上发的不知道谁给我删了。

文章评论

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

  • blankyao发表评论: 2008-1-12 13:13:45
  • 习明发表评论: 2008-1-12 16:12:04
  • 晕 我前两天还看见dz上那个 真的就没了 貌似有谁对帖子做过清理 也有人反映自己的帖子没通知就进回收站了...
  • kimi发表评论: 2008-1-14 16:58:14
  • 不错 顶之