廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 33550 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
香吉士 手機
個人文章 個人相簿 個人日記 個人地圖
特殊貢獻獎 創作大師獎 創作大師獎-2 創作大師獎-3
知名人士
級別: 知名人士 該用戶目前不上站
推文 x234 鮮花 x555
分享: 轉寄此文章 Facebook Plurk Twitter 版主評分 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x1
[7.0][分享] 18禁區年齡限制[各版面後台設置]  (通用)
【插件資訊】

插件名稱:18禁區年齡限制[各版面後台設置]
適用版本:7.0
語言編碼:通用
插件作者:藍天綠地 |修改版:pole1010
版權所屬:藍天綠地 |修改版:pole1010
原帖連結:http://coz.tw/dz6/thre...1-1.html
支持網站:http://pole.twhosts.info/uploa...y.php?fid=13

【插件說明】

數據庫升級
複製程式
ALTER TABLE `cdb_forums` ADD `isadult` TINYINT( 1 ) DEFAULT '0' NOT NULL

include/common.inc.php

複製程式
m.sigstatus,
之前加入
複製程式
m.bday,

forumdisplay.php

複製程式
    } elseif($forum['password'] != $_DCOOKIE['fidpw'.$fid]) {
                include template('forumdisplay_passwd');
                exit();
        }
}

下面加
複製程式
if ($bday == '0000-00-00') {
    if ($forum['isadult']) {
                showmessage('你還未設定生日日期,請先到控制台設定。','memcp.php?action=profile');
        }
}else{
        list($year, $month, $day) = explode('-', $bday);
        $bday = intval($year) ? $dateformat : preg_replace("/[^nj]*[Yy][^nj]*/", '', $dateformat);
        $bday = str_replace('n', $month, $bday);
        $bday = str_replace('j', $day, $bday);
        $bday = str_replace('Y', $year, $bday);
        $bday = str_replace('y', substr($year, 2, 4), $bday);
        $birth_y = date("y");
        $birth_m = date("m");
        $birth_d = date("d");
        $birthyear = intval($bday);
        $birthyears = $year > $birth_y ? gmdate('Y', $timestamp + $data['timeoffset'] * 3600) - $birthyear : '';
        $checkbday = $birthyears ? ''.($birth_m > $month ? $birthyears : ''.($birth_m >= $month && $birth_d >= $day ? $birthyears : $birthyears - 1).'').'' : '';
}

if ($forum['isadult'] && $checkbday < 18) {
    if ($groupid != 7) {
                showmessage('對不起!您現時只有 '.$checkbday.' 歲,本論壇只有 18 歲以上用戶才可以訪問,請返回。','index.php');
        }else{
                showmessage('對不起!請您先登入或註冊,本論壇只有 18 歲以上用戶才可以訪問,請返回。','logging.php?action=login');
        }
}

viewthread.php

複製程式
if(empty($forum['allowview'])) {

        if(!$forum['viewperm'] && !$readaccess) {
                showmessage('group_nopermission', NULL, 'NOPERM');
        } elseif($forum['viewperm'] && !forumperm($forum['viewperm'])) {
                $navtitle = '';
                showmessage('forum_nopermission', NULL, 'NOPERM');
        }

下面加
複製程式
if ($bday == '0000-00-00') {
    if ($forum['isadult']) {
                showmessage('你還未設定生日日期,請先到控制台設定。','memcp.php?action=profile');
        }
}else{
        list($year, $month, $day) = explode('-', $bday);
        $bday = intval($year) ? $dateformat : preg_replace("/[^nj]*[Yy][^nj]*/", '', $dateformat);
        $bday = str_replace('n', $month, $bday);
        $bday = str_replace('j', $day, $bday);
        $bday = str_replace('Y', $year, $bday);
        $bday = str_replace('y', substr($year, 2, 4), $bday);
        $birth_y = date("y");
        $birth_m = date("m");
        $birth_d = date("d");
        $birthyear = intval($bday);
        $birthyears = $year > $birth_y ? gmdate('Y', $timestamp + $data['timeoffset'] * 3600) - $birthyear : '';
        $checkbday = $birthyears ? ''.($birth_m > $month ? $birthyears : ''.($birth_m >= $month && $birth_d >= $day ? $birthyears : $birthyears - 1).'').'' : '';
}

if ($forum['isadult'] && $checkbday < 18) {
    if ($groupid != 7) {
                showmessage('對不起!您現時只有 '.$checkbday.' 歲,本論壇只有 18 歲以上用戶才可以訪問,請返回。','index.php');
        }else{
                showmessage('對不起!請您先登入或註冊,本論壇只有 18 歲以上用戶才可以訪問,請返回。','logging.php?action=login');
        }
}

admin/forums.inc.php

複製程式
showsetting('forums_edit_basic_display', 'statusnew', $forum['status'], 'radio');
下面加
複製程式
showsetting('forums_edit_basic_isadult', 'isadultnew', $forum['isadult'], 'radio');


複製程式
status='$statusnew',

後面加(要空白一格)
複製程式
isadult='$isadultnew',
templates/default/admincp.lang.php

複製程式
'forums_edit_basic_scheme' => '論壇設置方案:',

上面加
複製程式
'forums_edit_basic_isadult' => '18禁板塊:',
'forums_edit_basic_isadult_comment' => '限制瀏覽會員必須為18歲以上',

限制發文回覆
post.php

複製程式
if(empty($forum['allowview'])) {
        if(!$forum['viewperm'] && !$readaccess) {
                showmessage('group_nopermission', NULL, 'NOPERM');
        } elseif($forum['viewperm'] && !forumperm($forum['viewperm'])) {
                showmessage('forum_nopermission', NULL, 'NOPERM');
        }

下面加
複製程式
if ($bday == '0000-00-00') {
    if ($forum['isadult']) {
                showmessage('你還未設定生日日期,請先到控制台設定。','memcp.php?action=profile');
        }
}else{
        list($year, $month, $day) = explode('-', $bday);
        $bday = intval($year) ? $dateformat : preg_replace("/[^nj]*[Yy][^nj]*/", '', $dateformat);
        $bday = str_replace('n', $month, $bday);
        $bday = str_replace('j', $day, $bday);
        $bday = str_replace('Y', $year, $bday);
        $bday = str_replace('y', substr($year, 2, 4), $bday);
        $birth_y = date("y");
        $birth_m = date("m");
        $birth_d = date("d");
        $birthyear = intval($bday);
        $birthyears = $year > $birth_y ? gmdate('Y', $timestamp + $data['timeoffset'] * 3600) - $birthyear : '';
        $checkbday = $birthyears ? ''.($birth_m > $month ? $birthyears : ''.($birth_m >= $month && $birth_d >= $day ? $birthyears : $birthyears - 1).'').'' : '';
}

if ($forum['isadult'] && $checkbday < 18) {
    if ($groupid != 7) {
                showmessage('對不起!您現時只有 '.$checkbday.' 歲,本論壇只有 18 歲以上用戶才可以訪問,請返回。','index.php');
        }else{
                showmessage('對不起!請您先登入或註冊,本論壇只有 18 歲以上用戶才可以訪問,請返回。','logging.php?action=login');
        }
}

更新緩存
修改完後請至版塊限制!!
後臺顯示:


如未達到年齡:




反安裝
複製程式
ALTER TABLE `cdb_forums` DROP `isadult` TINYINT( 1 ) DEFAULT '0' NOT NULL

此文章被評分,最近評分記錄
財富:100 (by aa) | 理由: 活動獎勵..^^



獻花 x1 回到頂端 [樓 主] From:歐洲 | Posted:2009-09-21 18:54 |

首頁  發表文章 發表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.027147 second(s),query:15 Gzip disabled
本站由 瀛睿律師事務所 擔任常年法律顧問 | 免責聲明 | 本網站已依台灣網站內容分級規定處理 | 連絡我們 | 訪客留言