วิธีการทำกระดานข่าวสำหรับสมาชิกอายุ 18+
แก้ไขล่าสุด theerawut เมื่อ 2009-4-9 23:55pole1010
ตัวอย่างใน admincp
ตัวอย่างเมื่อผู้ใช้ไม่ได้กรอกวันเกิด
เมื่อผู้ใช้อายุต่ำว่า 18 ปี
วิธีการ mod
1. นำข้าฐานข้อมูลเครื่องมือ >> ฐานข้อมูล >> รันคิวรี้
**** Hidden Message *****
2.เปิดไฟล์ {bbs}/include/common.inc.php
ค้นหาm.sigstatus,เพิ่มโค๊ดนี้ต่อไปm.bday,
3.เปิดไฟล์ {bbs}/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]*[^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('ขออภัยค่ะ! กรุณาสมัครสมาชิกหรือเข้าสู่ระบบก่อนใช้งานกระดานข่าวนี้ค่ะ','logging.php?action=login');
}
}
4.เปิดไฟล์{bbs}/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]*[^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('ขออภัยค่ะ! กรุณาสมัครสมาชิกหรือเข้าสู่ระบบก่อนใช้งานกระดานข่าวนี้ค่ะ','logging.php?action=login');
}
}
5.เปิดไฟล์ {bbs}/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',6.เปิดไฟล์{bbs}/templates/default/admincp.lang.php
ค้นหา'forums_edit_basic_scheme' =>เพิ่มโค๊ดนี้ด้านบน 'forums_edit_basic_isadult' => 'เปิดใช้งานกระดานข่าวเฉพาะ 18+:',
'forums_edit_basic_isadult_comment' => 'สมาชิกต้องอายุ 18 ปีขึ้นไปเท่านั้นจึงจะสามาถใช้งานกระดานข่าวนี้ได้',
7.เปิดไฟล์{bbs}/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]*[^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('ขออภัยค่ะ! กรุณาสมัครสมาชิกหรือเข้าสู่ระบบก่อนใช้งานกระดานข่าวนี้ค่ะ','logging.php?action=login');
}
}
Update Cache ครับเป็นอันเสร็จพิธี ขอบคุณมากครับ ... แฮ่ม ... อาจจะนำไปใช้บ้าง :loveliness: เจ๋งเลยครับ เอ เว็บอารายหว่า 18+ {:18_763:} 1# theerawut
น่าสนใจคับ น่าสนมากครับ หุหุ ขอบคุณครับ ปลอดภัยดี thankkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk 1# theerawut
thanks ขออนุญาติเอาไปใช้นะครับ