########################################################
## Mod Title: 限制18歲以下的會員瀏覽某版面 --
## Mod Version: 1.8.0
## Mod Date: 2004 2月 23日
##
## By: Martinet Oaf < oafwork@hotmail.com >
##
## Description:
## 需搭配生日Mod使用
## 讓你的某幾個版面不給18歲以下的會員瀏覽
##
#
## Installation Level: 簡單
## Installation Time: 5 分鐘
## Files To Edit: 6
## Included Files: (NONE)
##
########################################################
## Author Notes:
## 抓蟲蟲....抓蟲蟲...抓蟲蟲.......
##
## 讓小正太門在首頁也看不到18X的版面 , 而且從(未滿18無法瀏覽..) 變成 查無此版面\r
##
########################################################
ALTER TABLE `phpbb_forums` ADD `adult_only` INT( 1 ) DEFAULT '0' NOT NULL ;
-----------
打開 viewtopic.php
找到\r
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
WHERE $join_sql
AND f.forum_id = t.forum_id
$order_sql";
裡面找到\r
f.auth_attachments
後面加上
,f.adult_only
找到\r
// Start auth check
//
前面加上
//18禁check By Martinet Oaf~
//echo $userdata['user_id'];
$idtemp = $userdata['user_id'];
$time_now = time();
$date_now = create_date('md', $time_now, $board_config['board_timezone']);
$date_forward = create_date('md', $time_now+($board_config['birthday_check_day']*86400), $board_config['board_timezone']);
$sql = "SELECT user_id, username, user_birthday, user_level FROM ".USERS_TABLE." WHERE user_id= $idtemp";
if(!$result = $db->sql_query($sql))
{
$pass = "false";
message_die(GENERAL_ERROR, "Could not fetch birthday for users.", "", __LINE__, __FILE__, $sql);
} else
{
$birthdayrows = array();
$birthdayrows = $db->sql_fetchrowset($result);
}
if (!empty($birthdayrows))
{
$this_year = create_date('Y', $time_now, $board_config['board_timezone']);
$date_today = $this_year.$date_now;
$date_forward = $this_year.$date_forward;
while (list($user_number, $birthdayrow) = each($birthdayrows))
{
$user_birthday2 = $this_year.($user_birthday = realdate("md",$birthdayrow['user_birthday'] ));
// give user a year more, if he alread have had birthday
$user_age = $this_year - realdate ( 'Y',$birthdayrow['user_birthday'] );
if ( $user_birthday2 < $date_today ) $user_birthday2 += 10000;
if ( $user_birthday2 == $date_today )
{
//user have birthday today
$user_age = $this_year - realdate ( 'Y',$birthdayrow['user_birthday'] );
}
}
}
if(($user_age<18 ||!$userdata['session_logged_in'] ) && $forum_topic_data['adult_only'])
{
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
//18禁check完畢\r
---------
打開 viewforum.php
找到\r
// Start auth check
//
前面加上
//18禁check By Martinet Oaf~
//echo $userdata['user_id'];
$idtemp = $userdata['user_id'];
$time_now = time();
$date_now = create_date('md', $time_now, $board_config['board_timezone']);
$date_forward = create_date('md', $time_now+($board_config['birthday_check_day']*86400), $board_config['board_timezone']);
$sql = "SELECT user_id, username, user_birthday, user_level FROM ".USERS_TABLE." WHERE user_id= $idtemp";
if(!$result = $db->sql_query($sql))
{
$pass = "false";
message_die(GENERAL_ERROR, "Could not fetch birthday for users.", "", __LINE__, __FILE__, $sql);
} else
{
$birthdayrows = array();
$birthdayrows = $db->sql_fetchrowset($result);
}
if (!empty($birthdayrows))
{
$this_year = create_date('Y', $time_now, $board_config['board_timezone']);
$date_today = $this_year.$date_now;
$date_forward = $this_year.$date_forward;
while (list($user_number, $birthdayrow) = each($birthdayrows))
{
$user_birthday2 = $this_year.($user_birthday = realdate("md",$birthdayrow['user_birthday'] ));
// give user a year more, if he alread have had birthday
$user_age = $this_year - realdate ( 'Y',$birthdayrow['user_birthday'] );
if ( $user_birthday2 < $date_today ) $user_birthday2 += 10000;
if ( $user_birthday2 == $date_today )
{
//user have birthday today
$user_age = $this_year - realdate ( 'Y',$birthdayrow['user_birthday'] );
}
}
}
if(($user_age<18 ||!$userdata['session_logged_in'] ) && $forum_row['adult_only'])
{
message_die(GENERAL_MESSAGE, 'Forum_not_exist');
}
//18禁check完畢\r
-----
打開 admin/admin_forums.php
找到
$forumstatus = $row['forum_status'];
後面加上
$forum_adultonly_status = $row['adult_only'];
找到
$forumstatus = FORUM_UNLOCKED;
$forum_id = '';
$prune_enabled = '';
後面加上
$forum_adultonly_status = 0;
找到\r
'S_PRUNE_ENABLED' => $prune_enabled,
後面加上
'S_FORUM_ADULTONLY_YES' => ($forum_adultonly_status==1)? 'checked' : '',
'S_FORUM_ADULTONLY_NO' => ($forum_adultonly_status!=1)? 'checked' : '',
找到
'L_DAYS' => $lang['Days'],
後面加上
'L_ADULTONLY' => $lang['adult_only'],
'L_AD_YES' => $lang['adult_only_yes'],
'L_AD_NO' => $lang['adult_only_no'],
找到
$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";
在行內找到
prune_enable
後面加上
, adult_only
在行內找到
$value_sql
前面加上
",'".$HTTP_POST_VARS['adult_only']."'".
找到\r
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
在行內找到\r
prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
後面加上
,adult_only = '".$HTTP_POST_VARS['adult_only']."'
---------
打開 language/your_language/lang_admin.php
找到\r
//
// That's all Folks!
// -------------------------------------------------
前面加上
$lang['adult_only'] = '未滿18歲不能進入本版面?';
$lang['adult_only_yes'] = '是';
$lang['adult_only_no'] = '否';
-----------------
打開 index.php
找到\r
//
// Start output of page
//
前面加上
//18禁check By Martinet Oaf~
//echo $userdata['user_id'];
$idtemp = $userdata['user_id'];
$time_now = time();
$date_now = create_date('md', $time_now, $board_config['board_timezone']);
$date_forward = create_date('md', $time_now+($board_config['birthday_check_day']*86400), $board_config['board_timezone']);
$sql = "SELECT user_id, username, user_birthday, user_level FROM ".USERS_TABLE." WHERE user_id= $idtemp";
if(!$result = $db->sql_query($sql))
{
$pass = "false";
message_die(GENERAL_ERROR, "Could not fetch birthday for users.", "", __LINE__, __FILE__, $sql);
} else
{
$birthdayrows = array();
$birthdayrows = $db->sql_fetchrowset($result);
}
if (!empty($birthdayrows))
{
$this_year = create_date('Y', $time_now, $board_config['board_timezone']);
$date_today = $this_year.$date_now;
$date_forward = $this_year.$date_forward;
while (list($user_number, $birthdayrow) = each($birthdayrows))
{
$user_birthday2 = $this_year.($user_birthday = realdate("md",$birthdayrow['user_birthday'] ));
// give user a year more, if he alread have had birthday
$user_age = $this_year - realdate ( 'Y',$birthdayrow['user_birthday'] );
if ( $user_birthday2 < $date_today ) $user_birthday2 += 10000;
if ( $user_birthday2 == $date_today )
{
//user have birthday today
$user_age = $this_year - realdate ( 'Y',$birthdayrow['user_birthday'] );
}
}
}
if(!$userdata['session_logged_in'])
{
$user_age = 15;
}
找到\r
for($j = 0; $j < $total_forums; $j++)
{
後面加上
$pass = false;
if($forum_data[$j]['adult_only'] ==0 )
{
$pass = true;
}
else if($user_age>=18)
{
$pass = true;
}
找到\r
if ( $is_auth_ary[$forum_id]['auth_view'] )
{
取代為\r
if ( $is_auth_ary[$forum_id]['auth_view'] &&$pass)
{
打開 template/你的風格/admin/forum_edit_body.tpl
找到
<tr>
<td class="row1">{L_FORUM_NAME}</td>
<td class="row2"><input type="text" size="25" name="forumname" value="{FORUM_NAME}" class="post" /></td>
</tr>
後面加上
<tr>
<td class="row1">{L_ADULTONLY}</td>
<td class="row2">{L_AD_YES}<input type="radio" name="adult_only" value="1" class="post" {S_FORUM_ADULTONLY_YES}/>
   {L_AD_NO}<input type="radio" name="adult_only" value="0" class="post" {S_FORUM_ADULTONLY_NO}/></td>
</tr>
[外掛]未滿18禁止觀看某版面--1.8.0資料庫版
MODs Released by Other phpbb Sites
非官方認證通過之 MOD ,或許有安全性之疑慮,所有問題由原發表者回覆!
非官方認證通過之 MOD ,或許有安全性之疑慮,所有問題由原發表者回覆!
版主: 版主管理群
前往
- Announcement
- ↳ 系統公告區
- Support
- ↳ [3.3.x] 安裝與使用
- ↳ [3.3.x] 中文
- ↳ [3.3.x] 轉換
- ↳ [3.2.x] 安裝與使用
- ↳ [3.2.x] 中文
- ↳ [3.2.x] 轉換
- Extensions
- ↳ 官方認證擴充功能
- ↳ [3.2.x] 官方認證擴充功能
- ↳ [3.3.x] 官方認證擴充功能
- ↳ 非官方認證擴充功能
- ↳ 擴充功能問題討論
- Style
- ↳ 官方認證風格
- ↳ [3.2.x] 官方認證風格
- ↳ [3.3.x] 官方認證風格
- ↳ 風格問題討論
- Knowledge
- ↳ 教學文件庫
- ↳ 2.0
- ↳ 3.0
- ↳ 3.1
- ↳ 3.2
- ↳ 3.3
- ↳ phpBB 技術文件與知識庫
- ↳ 2.0
- ↳ 3.0
- ↳ 3.1
- ↳ 3.2
- Non-phpBB specific
- ↳ 塔羅占卜
- ↳ 塔羅精華
- ↳ 每週運勢
- ↳ 我想發問
- ↳ 站長交流
- ↳ 自由軟體或免費軟體
- ↳ 架站
- ↳ AppServ
- ↳ WampServer
- ↳ XAMPP
- ↳ phpMyAdmin
- ↳ ExoBUD MP
- ↳ 4images
- ↳ Coppermine Photo Gallery
- ↳ 網路
- ↳ 文書
- ↳ 檔案
- ↳ 美工
- ↳ 系統
- ↳ 安全
- ↳ 多媒體
- ↳ 遊戲
- ↳ 光碟
- ↳ 休閒哈拉與心情小品
- ↳ 意見反應或無法分類
- Link
- ↳ 竹貓星球數位(股)
- ↳ FaceBook_phpBB3-官方中文支援
- ↳ SSD 不限流量-網站空間( .tw or .com.tw域名免費送)
- ↳ 推薦網站
- ↳ phpBB.com
- ↳ phpBBHacks.com
- Archives
- ↳ phpBB 3.1.x Forum Archive
- ↳ [3.1.x] 安裝與使用
- ↳ [3.1.x] 中文
- ↳ [3.1.x] 轉換
- ↳ [3.1.x] 官方認證風格
- ↳ phpBB 3.0.x Forum Archive
- ↳ [3.0.x] Support
- ↳ [3.0.x] 安裝與使用
- ↳ [3.0.x] 中文
- ↳ [3.0.x] 轉換
- ↳ [3.0.x] Mod
- ↳ [3.0.x] 官方認證外掛
- ↳ [3.0.x] 非官方認證外掛
- ↳ [3.0.x] 外掛問題討論
- ↳ [3.0.x] Style
- ↳ [3.0.x] 官方認證風格
- ↳ [3.0.x] 非官方認證風格
- ↳ [3.0.x] 風格問題討論
- ↳ phpBB2 Forum Archive
- ↳ Support
- ↳ phpBB 2 安裝與使用
- ↳ phpBB 2 plus 綜合討論
- ↳ MOD
- ↳ 官方認證外掛
- ↳ 非官方認證外掛
- ↳ 外掛問題討論
- ↳ Style
- ↳ 官方認證風格
- ↳ 非官方認證風格
- ↳ 風格問題討論