22 พฤษภาคม 2555, 16:29:55
ยินดีต้อนรับผู้เยี่ยมชม
  • noavata
  • ยินดีต้อนรับคุณ, ผู้เยี่ยมชม กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน
    เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น
Page Rank

ทำเว็บไซต์ | แต่งบอร์ด | ออกแบบ | SMF | Joomla | Drupal | WordPress | JQuery | CMS | ECommerce | Tel. +668-08577477

ส่งหัวข้อนี้พิมพ์ หน้า: 1 
icon message ผู้เขียน หัวข้อ: Password Protect Boards ล๊อคบอร์ดด้วยรหัสผ่าน  (อ่าน 1171 ครั้ง)
0 สมาชิก และ 2 ผู้เยี่ยมชม กำลังดูหัวข้อนี้
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general เมื่อ: 29 มิถุนายน 2553, 21:59:38
  • ชื่อ: Password Protect Boards
  • ผู้เขียน: Dragooon
  • นำเสนอโดย: DexMoreGroup
  • ประเภท: Security and Moderation
  • รองรับ: SMF 1.1.xx
  • ปรับปรุงล่าสุด: 8 มีนาคม 2551
  • ต้นฉบับ: Password Protect Boards

รายละเอียด
      mod นี้ใช้สำหรับกำหนดรหัสผ่านในการเข้าใช้งานบอร์ด ซึ่งสามารถกำหนดใช้ในแต่ละบอร์ดได้อย่างอิสระ และแต่ละบอร์ดก็สามารถกำหนดรหัสผ่านให้แตกต่างกันได้

ตัวอย่าง




แก้ไขไฟล์:

file $sourcedir/Load.php

ค้นหา -->>
โค๊ด: [Select]
b.ID_THEME, b.override_theme, b.permission_mode, b.countPosts

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
, b.passwd

ค้นหา -->>
โค๊ด: [Select]
'posts_count' => empty($row['countPosts']),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'passwd' => $row['passwd'],

ค้นหา -->>
โค๊ด: [Select]
if ($user_info['is_mod'])
$user_info['groups'][] = 3;

เพิ่มไว้หลัง -->>
โค๊ด: [Select]

// Can they view this board?
if ( !$user_info['is_admin'] && !$user_info['is_mod'] && $board_info['passwd'] && !in_array($board, $_SESSION['board_access']) )
{
if ( !isset($_POST['passwd']) || sha1($board_info['name'].$_POST['passwd']) != $board_info['passwd'] )
{
loadPermissions();
loadTheme();
require_once($GLOBALS['sourcedir'] . '/passwdBoard.php');
passwdBoardFailed(!empty($board) ? "board=$board" : "topic=$topic");
}
else
$_SESSION['board_access'][] = $board;
}

ค้นหา -->>
โค๊ด: [Select]
$sc = $_SESSION['rand_code'];

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
if ( !isset($_SESSION['board_access']) )
$_SESSION['board_access'] = array();

ค้นหา -->>
โค๊ด: [Select]
// Registered user.... just the groups in $user_info['groups'].
else
$user_info['query_see_board'] = '(FIND_IN_SET(' . implode(', b.memberGroups) OR FIND_IN_SET(', $user_info['groups']) . ', b.memberGroups))';

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
// Passwordify it!
if(!$user_info['is_admin'] && !empty($_SESSION['board_access']))
$user_info['query_see_board'] .= "AND (b.ID_BOARD IN (".implode(',',$_SESSION['board_access']).") OR CHAR_LENGTH(b.passwd) = 0)";
elseif(!$user_info['is_admin'])
$user_info['query_see_board'] .= 'AND CHAR_LENGTH(b.passwd) = 0';

file $sourcedir/BoardIndex.php

ค้นหา -->>
โค๊ด: [Select]
IFNULL(mods_mem.ID_MEMBER, 0) AS ID_MODERATOR, mods_mem.realName AS modRealName

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
, b.passwd

ค้นหา -->>
โค๊ด: [Select]
'href' => $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0',

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'passwd' => !empty($row_board['passwd']),

ค้นหา -->>
โค๊ด: [Select]
// Find all boards and categories, as well as related information.  This will be sorted by the natural order of boards and categories, which we control.

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Had to copy!
// Password Protect Board Edits
if ($user_info['is_guest'])
$query_see_board = 'FIND_IN_SET(-1, b.memberGroups)';
// Administrators can see all boards.
elseif ($user_info['is_admin'])
$query_see_board = '1';
// Registered user.... just the groups in $user_info['groups'].
else
$query_see_board = '(FIND_IN_SET(' . implode(', b.memberGroups) OR FIND_IN_SET(', $user_info['groups']) . ', b.memberGroups))';


ค้นหา -->>
โค๊ด: [Select]
WHERE $user_info[query_see_board]

แก้เป็น -->>
โค๊ด: [Select]
WHERE $query_see_board

ค้นหา -->>
โค๊ด: [Select]
// Determine a global most recent topic.
if (!empty($row_board['posterTime']) && forum_time(true, $row_board['posterTime']) > $most_recent_topic['timestamp'])
$most_recent_topic = array(
'timestamp' => forum_time(true, $row_board['posterTime']),
'ref' => &$this_category[$isChild ? $row_board['ID_PARENT'] : $row_board['ID_BOARD']]['last_post'],
);

แก้เป็น -->>
โค๊ด: [Select]
// Determine a global most recent topic.
// Edited by Password Protect boards
if (!empty($row_board['posterTime']) && forum_time(true, $row_board['posterTime']) > $most_recent_topic['timestamp'] && (empty($row_board['passwd']) || in_array($row_board['ID_BOARD'], $_SESSION['board_access']) || $user_info['is_admin']))
$most_recent_topic = array(
'timestamp' => forum_time(true, $row_board['posterTime']),
'ref' => &$this_category[$isChild ? $row_board['ID_PARENT'] : $row_board['ID_BOARD']]['last_post'],
);

file $sourcedir/Subs-Boards.php

ค้นหา -->>
โค๊ด: [Select]
if (isset($boardOptions['board_name']))
$boardUpdates[] = 'name = \'' . $boardOptions['board_name'] . '\'';

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
if (isset($boardOptions['board_name']))
$boardUpdates[] = 'name = \'' . $boardOptions['board_name'] . '\'';

ค้นหา -->>
โค๊ด: [Select]
b.permission_mode, c.ID_CAT, c.name AS cName, c.catOrder, c.canCollapse

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
, b.passwd

ค้นหา -->>
โค๊ด: [Select]
'prev_board' => $prevBoard

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
'passwd' => !empty($row['passwd']),

file $sourcedir/ManageBoards.php

ค้นหา -->>
โค๊ด: [Select]
'override_theme' => 0,

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'passwd' => '',

ค้นหา -->>
โค๊ด: [Select]
$boardOptions['board_description'] = preg_replace('~[&]([^;]{8}|[^;]{0,8}$)~', '&$1', $_POST['desc']);

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
if ( $_POST['passwdBoard'] != "#FAKEPASSWORD" )
$boardOptions['passwd'] = !empty($_POST['passwdBoard']) ? sha1($boardOptions['board_name'].$_POST['passwdBoard']) : '';

file $themedir/ManageBoards.template.php

ค้นหา -->>
โค๊ด: [Select]
// Finish off the table.

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
echo '
<tr>
<td>
<b>', $txt['passwdBoard1'], '</b><br />
', $txt['passwdBoard2'], '<br /><br />
</td>
<td align="right">
<input type="password" name="passwdBoard" value="', $context['board']['passwd'] ? '#FAKEPASSWORD' : '', '" />
</td>
</tr>';

file $themedir/BoardIndex.template.php

ค้นหา -->>
โค๊ด: [Select]
// Show some basic information about the number of posts, etc.

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
if ( !$context['user']['is_admin'] && !$context['user']['is_mod'] && !isset($board['moderators'][$context['user']['id']]) && $board['passwd'] && !in_array($board['id'], $_SESSION['board_access']) )
echo '<br/>
', $txt['passwdBoard3'], '
<form style="display:inline" action="', $board['href'], '" method="post">
<input type="password" name="passwd" />
<input type="submit" value="', $txt['passwdBoard4'], '" />
</form>';
else if ( $board['passwd'] )
echo '<img src="', $settings['images_url'], '/icons/quick_lock.gif" style="vertical-align:bottom" title="', $txt['passwdBoard6'], '" />';

ค้นหา -->>
โค๊ด: [Select]
/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
if (!empty($board['last_post']['id']))
echo '
<b>', $txt[22], '</b>  ', $txt[525], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['smf88'], ' ', $board['last_post']['link'], '<br />
', $txt[30], ' ', $board['last_post']['time'];

แก้เป็น -->>
โค๊ด: [Select]
/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
// Edited by password protect board
if (!empty($board['last_post']['id']) && (empty($board['passwd']) || in_array($board['id'],$_SESSION['board_access']) || $context['user']['is_admin']))
echo '
<b>', $txt[22], '</b>  ', $txt[525], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['smf88'], ' ', $board['last_post']['link'], '<br />
', $txt[30], ' ', $board['last_post']['time'];

file $themedir/languages/Modifications.thai-utf8.php

เพิ่ม -->>
ขออภัย! ส่วนนี้สงวนไว้เฉพาะสมาชิกเท่านั้น กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

ดาวน์โหลด: passwdBoard.rar
ขออภัย! ส่วนนี้สงวนไว้เฉพาะสมาชิกเท่านั้น กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

แตกไฟล์แล้วอัพโหลดไปไว้ที่
file passwdBoard.php -->> $sourcedir
file passwdBoard.template.php -->> $themesdir/default

สร้างไฟล์: add_settings.php เพื่อสร้างฐานข้อมูล ไว้ใน $boarddir (ที่เดียวกับไฟล์ SSI.php) รัน http://www.your_url.xxx/$boarddir/add_settings.php -->> Enter เสร็จแล้วลบทิ้ง
โค๊ด: [Select]
<?php
/**********************************************************
* IgnoreBoards
* Written by Michael Miller
* copyright (C) 2004 Michael Miller
**********************************************************/


// If SSI.php is in the same place as this file, and SMF isn't defined, this is being run standalone.
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
// Hmm... no SSI.php and no SMF?
elseif (!defined('SMF'))
die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');
$res db_query("SHOW COLUMNS FROM {$db_prefix}boards LIKE 'passwd'"__FILE____LINE__);
if ( 
mysql_num_rows($res) == )
{
$res db_query("ALTER TABLE {$db_prefix}boards ADD passwd VARCHAR(64) NOT NULL"__FILE____LINE__);
if ( !$res )
echo "Could not alter the table: {$db_prefix}boards to add in the required column";
}
?>


การตั้งค่า: ผู้ดูแล -->> แก้ไขบอร์ด -->> ใช้รหัสผ่านสำหรับบอร์ดนี้

ลิงค์หัวข้อ: http://dexmore.com/topic/2215
Windows XP    Firefox 3.6.6   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
*



Bhutan   ชาย ออฟไลน์ เว็บไซต์
icon message
general ความคิดเห็นที่ 1 เมื่อ: 29 สิงหาคม 2554, 21:58:35
ลองเอาไปใช้แล้ว ปรากฏว่าใส่พาสเวิร์ดแต่ระบบไม่จำในหน้า ผู้ดูแล

ลอง Double, Triple Check Code แล้วไม่น่ามีอะไรผิดพลาด พอเดาได้ไหมครับว่าเกิดจากอะไร

ลิงค์หัวข้อ: http://dexmore.com/topic/2215
Windows NT 6.1    Firefox 6.0   see ip บันทึกการเข้า
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 2 เมื่อ: 29 สิงหาคม 2554, 22:29:39
เกี่ยวกับฐานข้อมูลครับตรวจสอบฟิลด์ passwd ในตาราง boards

ลิงค์หัวข้อ: http://dexmore.com/topic/2215
Thx by โซ
Windows XP    Firefox 6.0   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
*



Bhutan   ชาย ออฟไลน์ เว็บไซต์
icon message
general ความคิดเห็นที่ 3 เมื่อ: 29 สิงหาคม 2554, 22:46:24
file $sourcedir/Subs-Boards.php

ค้นหา -->>
โค๊ด: [Select]

   if (isset($boardOptions['board_name']))
      $boardUpdates[] = 'name = \'' . $boardOptions['board_name'] . '\'';


เพิ่มไว้หลัง -->>
โค๊ด: [Select]

   if (isset($boardOptions['board_name']))
      $boardUpdates[] = 'name = \'' . $boardOptions['board_name'] . '\'';

2 อันนี้ไม่มีอะไรผิดใช่ไหมครับ เห็นเพิ่มชุดเดียวกันซ้ำไว้ในไฟล์เดียวกัน

ส่วนอื่นๆลองเช็คดูแล้วครับไม่น่ามีปัญหา สร้างไฟล์ php แล้ว แต่ก็รู้สึกเหมือนเดิม สงสัยถ้าไม่ได้คงต้องเอาออกเลย =_=

ลิงค์หัวข้อ: http://dexmore.com/topic/2215
Windows NT 6.1    Firefox 6.0   see ip บันทึกการเข้า
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 4 เมื่อ: 29 สิงหาคม 2554, 23:33:32
รันไฟล์ add_settings.php แล้วอาจจะไม่มีการดำเนินการใดๆ กับฐานข้อมูลก็ได้นะครับ

อ่านกระทู้นี้ครับ -->> การแทรก เพิ่มตาราง และฟิลด์ใน phpMyadmin ของ mod SMF

ลิงค์หัวข้อ: http://dexmore.com/topic/2215
Windows XP    Firefox 6.0   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
*



Bhutan   ชาย ออฟไลน์ เว็บไซต์
icon message
general ความคิดเห็นที่ 5 เมื่อ: 4 กันยายน 2554, 21:28:41
ลองดูใน boards เห็นมันสร้างตาราง passwd แล้วนะครับ

แต่ไม่รู้ว่ามีอะไรพลาดไปอีกหรือเปล่า



ตามนี้เลยครับ ตั้งพาสแล้วไม่จำค่า และมันก็ไม่ขึ้นกล่องให้ใส่พาสเวิร์ดอีกตะหาก

ลิงค์หัวข้อ: http://dexmore.com/topic/2215
Windows NT 6.1    Firefox 6.0.1   see ip บันทึกการเข้า
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 6 เมื่อ: 4 กันยายน 2554, 22:18:04
ถ้างั้นโมโค้ดผิดแล้วครับ mod นี้ผมเทสแล้วครับใช้งานได้จริง ถ้าผิดพลาดก็ผิืดพลาดที่การโมของคนโมเอง ถ้าอยากใช้ก็ทบทวนใหม่ครับ

ลิงค์หัวข้อ: http://dexmore.com/topic/2215
Windows XP    Firefox 6.0.1   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
*



Thailand   ชาย ออฟไลน์
icon message
general ความคิดเห็นที่ 7 เมื่อ: 17 ธันวาคม 2554, 08:37:51
Unknown column 'b.passwd' in 'field list'
ไฟล์: /home/thaifore/public_html/Sources/BoardIndex.php
บรรทัด: 99


ช่วยด้วยคับมันบอกตรงนี้ผิดพลาดอะครับ

อ้างถึง
   WHERE $query_see_board" . (empty($modSettings['countChildPosts']) ? "
         AND b.childLevel <= 1" : ''), __FILE__, __LINE__);


ลิงค์หัวข้อ: http://dexmore.com/topic/2215
« แก้ไขครั้งสุดท้าย: 17 ธันวาคม 2554, 08:40:09 โดย asia » Windows XP    Firefox 3.5.7   see ip บันทึกการเข้า
โฮสต์ดีๆ บริการด้วยใจ
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 8 เมื่อ: 17 ธันวาคม 2554, 08:58:06
ยังไม่มีการสร้างตารางในฐานข้อมูลครับคำตอบอยู่ในกระทู้ก่อนๆ นั่นแล้ว

ลิงค์หัวข้อ: http://dexmore.com/topic/2215
Windows XP    Firefox 8.0   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
*



Thailand   ชาย ออฟไลน์
icon message
general ความคิดเห็นที่ 9 เมื่อ: 2 กุมภาพันธ์ 2555, 20:23:54
มีวิธีทำ สำหรับ V 2.0 RC5 รึป่าวครับ พอดีผมลองทำตามเว็บ แล้วมันติดตรงที่ Unknown column 'b.passwd' in 'field list' นี่เเหละครับ

ลิงค์หัวข้อ: http://dexmore.com/topic/2215
Windows XP    Firefox 9.0.1   see ip บันทึกการเข้า
โฮสต์ดีๆ บริการด้วยใจ
ส่งหัวข้อนี้พิมพ์ หน้า: 1 
กระโดดไป:  

Creative Commons License

SMF Thai Translation Powered by SMF © 2006–2012, Simple Machines LLC

WordPress Google เข้าเยี่ยมชมหน้านี้ล่าสุดเมื่อ : 20 พฤษภาคม 2555, 11:53:55

jQuery Plugin Copyright © 2551-2555 Themes Design & Hosting by DexMoreGroup

Sitemap | Thai Simple Machines Forum support SMF Thai

Web Begining | SMF Modifications | SMF Thai Translation Web Begining

Drupal | WordPress | CMS Joomla | jQuery Plugin | Web Graphics CMS Joomla