Bạn ghé thăm diễn đàn lần đầu? hãy đăng ký ngay bây giờ để tham gia.
  • Đăng nhập:

Chào mừng bạn đến với ITVNN FORUM - Diễn đàn công nghệ thông tin.

Nếu đây là lần đầu tiên bạn tham gia diễn đàn, xin mời bạn xem phần Hỏi/Ðáp để biết cách dùng diễn đàn. Để có thể tham gia thảo luận bạn phải đăng ký làm thành viên, click vào đây để đăng ký.


  • Partner Area
    • ITVNN HOSTING - Thiết kế website, Cung cấp Domain, Hosting, VPS Việt Nam Anh Hùng - Thông tin truyền thông
kết quả từ 1 tới 1 trên 1
Tăng kích thước phông chữ Giảm kích thước phông chữ
  1. #1
    hau_ooo's Avatar

    Trạng thái
    Offline
    Họ tên
    Đoàn Hậu
    Tham gia ngày
    Sep 2009
    Thành viên thứ
    198
    Đến từ
    Hải Phòng
    Giới tính
    Bài gởi
    858
    Level: 45 [?]
    Experience: 4,559,610
    Next Level: 5,107,448
    Cảm ơn 84
    Cảm ơn 237 lần / 166 Bài viết

    Icon14 Tích hợp phpBB 3.0.5 với Nukevn 2.0 RC2  

    Nguồn : website Nukeviet.vn

    Đây là hướng dẫn cách nhúng diễn đàn phpbb3.x vào NukeViet 2.0 RC1 NoForum.
    Đặc tính của hack này:
    - Dùng toàn bộ chức năng quản lý members của phpbb thay cho module Your_Account của Nukeviet.
    - Mặt khác, Nukeviet có khả năng nhận biết members của phpbb.


    - Cách hack :

    ################################################## #############
    Lưu dự phòng
    ################################################## #############
    Lưu dự phòng toàn bộ site và database.

    ################################################## #############
    Tạo thư mục
    ################################################## #############
    Tạo thư mục: ./forum/

    ################################################## #############
    Cài đặt PHPBB3
    ################################################## #############
    - Tải file phpBB-3.0.5.zip theo URL:
    http://www.ohloh.net/p/phpbb/download?f ... -3.0.5.zip
    - unzip, copy toàn bộ files và các thư mục con trong thư mục phpBB3 lên thư mục forum mà ta vừa tạo trên webroot.
    - Truy cập vào http://ten_site/thu_muc_cai_nukeviet/forum/ để cài đặt như hướng dẫn của phpbb.
    Lưu ý 1: Phải cài cơ sở dữ liệu của phpbb trên cùng một database của Nukeviet.
    (Để tham khảo của Nukeviet, hãy xem trong file mainfile.php trên webroot);
    Lưu ý 2: tiếp đầu tố của phpbb3 phải khác với tiếp đầu tố của NukeViet.
    Lưu ý 3: khi tạo người quản trị diễn đàn, không dùng tên và email đã được sử dụng trong NukeViet.

    ################################################## #############
    Xóa files
    ################################################## #############
    Xóa các files sau đây:
    - admin/case/case.users.php
    - admin/language/Your_Account_vietnamese.php
    - admin/language/Your_Account_english.php
    - admin/links/links.editusers.php
    - admin/modules/users.php

    ################################################## #############
    Sửa file: modules/Your_Account/index.php
    ################################################## #############
    Thay toàn bộ nội dung file modules/Your_Account/index.php bằng nội dung dưới đây:

    PHP Code: 
    <?php
     
    /*
    * @Program:      NukeViet CMS v2.0 RC1
    * @File name:    Module Your_Account
    * @Version:    1.0
    * @Date:       09.05.2009
    * @Website:    www.nukeviet.vn
    * @Copyright:    (C) 2009
    * @License:    http://opensource.org/licenses/gpl-license.php GNU Public License
    */
     
    if ( ! defined('NV_SYSTEM') )
    {
       die( 
    "You can't access this file directly..." );
    }
     
    require_once ( 
    "mainfile.php" );
    $module_name basenamedirname(__file__) );
    get_lang$module_name );
    if ( 
    file_exists("" $datafold "/config_" $module_name ".php") )
    {
       @require_once ( 
    "" $datafold "/config_" $module_name ".php" );
    }
    if ( 
    defined('_MODTITLE') ) $module_title _MODTITLE;
     
    $index = ( defined('MOD_BLTYPE') ) ? MOD_BLTYPE 1;
     
    @include_once ( 
    "forum/config.php" );
     
    function 
    phpbb_get_board_config()
    {
       global 
    $db$table_prefix$cookie_domain$cookie_path;
       
    $board_config = array();
       
    $query "SELECT * FROM `" $table_prefix "config`";
       
    $result $db->sql_query$query );
       while ( 
    $row $db->sql_fetchrow($result) )
       {
          
    $board_config[$row['config_name']] = $row['config_value'];
       }
       if ( 
    $board_config['cookie_domain'] != $cookie_domain )
       {
          
    $query "UPDATE `" $table_prefix "config` SET `config_value`='" $cookie_domain "' WHERE `config_name`='cookie_domain'";
          
    $db->sql_query$query );
          
    $board_config['cookie_domain'] = $cookie_domain;
       }
       if ( 
    $board_config['cookie_path'] != $cookie_path )
       {
     
          
    $query "UPDATE `" $table_prefix "config` SET `config_value`='" $cookie_path "' WHERE `config_name`='cookie_path'";
          
    $db->sql_query$query );
          
    $board_config['cookie_path'] != $cookie_path;
       }
       return 
    $board_config;
    }
     
    $board_config phpbb_get_board_config();
     
    /**
    * userinfo()

    * @return
    */
    function userinfo()
    {
       global 
    $table_prefix$user_prefix$db$user_ar;
     
       if ( isset(
    $_GET['user_id']) )
       {
          
    $user_id intval$_GET['user_id'] );
       } elseif ( 
    defined('IS_USER') )
       {
          
    $user_id intval$user_ar[0] );
       }
       else
       {
          
    Header"Location: forum/ucp.php?mode=login" );
          exit();
       }
       if ( 
    $user_id <= )
       {
          
    Header"Location: forum/memberlist.php" );
          exit();
       }
     
       
    $sql "SELECT f.user_id FROM `" $table_prefix "users` f, `" $user_prefix "_users` n WHERE n.user_id = " $user_id " AND n.username = f.username";
       
    $result $db->sql_query$sql );
       
    $userinfo $db->sql_fetchrow$result );
       if ( ! 
    $userinfo )
       {
          
    Header"Location: forum/memberlist.php" );
          exit();
       }
       
    $f_user_id $userinfo['user_id'];
       
    Header"Location: forum/memberlist.php?mode=viewprofile&u=" $f_user_id );
       exit();
    }
     
    /**
    * NV_main()

    * @return
    */
    function acount_main()
    {
       if ( ! 
    defined('IS_USER') )
       {
          
    Header"Location: forum/ucp.php?mode=login" );
          exit();
       }
       else
       {
          
    Header"Location: forum/ucp.php" );
          exit();
       }
    }
     
    /**
    * new_user()

    * @return
    */
    function new_user()
    {
       if ( 
    defined('IS_USER') )
       {
          
    Header"Location: forum/ucp.php" );
          exit();
       }
       else
       {
          
    Header"Location: forum/ucp.php?mode=register" );
          exit();
       }
    }
     
    /**
    * pass_lost()

    * @return
    */
    function pass_lost()
    {
       if ( 
    defined('IS_USER') )
       {
          
    Header"Location: forum/ucp.php" );
          exit();
       }
       else
       {
          
    Header"Location: forum/ucp.php?mode=sendpassword" );
          exit();
       }
    }
     
    /**
    * logout()

    * @return
    */
    function logout()
    {
       global 
    $board_config;
       if ( ! 
    defined('IS_USER') )
       {
          
    Header"Location: forum/ucp.php?mode=login" );
          exit();
       }
       else
       {
          
    $sid $_COOKIE[$board_config['cookie_name'] . "_sid"];
          
    Header"Location: forum/ucp.php?mode=logout&sid=" $sid );
          exit();
       }
    }
     
    /**
    * login()

    * @return
    */
    function login()
    {
       if ( 
    defined('IS_USER') )
       {
          
    Header"Location: forum/ucp.php" );
          exit();
       }
       else
       {
          
    Header"Location: forum/ucp.php?mode=login" );
          exit();
       }
    }
     
    $op = ( isset($_POST['op']) and ! empty($_POST['op']) ) ? $_POST['op'] : $_GET['op'];
    if ( ! empty(
    $op) ) $op strip_tagstrim($op) );
     
    switch ( 
    $op )
    {
     
       case 
    "logout":
          
    logout();
          break;
     
       case 
    "userinfo":
          
    userinfo();
          break;
     
       case 
    "login":
          
    login();
          break;
     
       case 
    "new_user":
          
    new_user();
          break;
     
       case 
    "pass_lost":
          
    pass_lost();
          break;
     
       default:
          
    acount_main();
          break;
     
    }
     
    ?>
    ################################################## #############
    Sửa file: forum/common.php
    ################################################## #############

    Tìm đến dòng 127:

    PHP Code: 
    require($phpbb_root_path 'config.' $phpEx); 
    Thêm xuống dưới:

    PHP Code: 
    //NV060609
    require($phpbb_root_path 'nukeviet_config.' $phpEx);
    //END 
    ################################################## #############
    Sửa file: forum/constants.php
    ################################################## #############

    TÌm đến dòng 257:

    PHP Code: 
    define('ZEBRA_TABLE',            $table_prefix 'zebra'); 
    Thêm xuống dưới:

    PHP Code: 
     //NV060609
    define('NV_USER_TABLE',            $user_prefix '_users');
    define('NV_STATS_TABLE',            $prefix '_stats');
    define('NV_DATAPATH',            $datafold);
    define('NV_USERCOOKIE',            $nv_usercookie);
    //END 
    ################################################## #############
    Sửa file: forum/includes/functions_user.php
    ################################################## #############

    Tìm đến dòng 250:
    PHP Code: 
     $user_id $db->sql_nextid(); 
    Thêm xuống dưới:
    PHP Code: 
     //NV060609
    $sql "INSERT INTO " NV_USER_TABLE " (`user_id`, `username`, `viewuname`, `user_email`, `user_regdate`, `user_password`) 
    VALUES (NULL, '"
    .$user_row['username']."', '".$user_row['username']."', '".$user_row['user_email']."', '".time()."', '".md5(unique_id())."')";
    $db->sql_query($sql);
    @
    unlink(NV_DATAPATH "/ulist." $phpEx);
    //END 
    Tìm đến dòng 507:
    PHP Code: 
     $cache->destroy('sql'MODERATOR_CACHE_TABLE); 
    Thêm lên trên:
    PHP Code: 
     //NV060609
    $sql "DELETE FROM `" NV_USER_TABLE "` WHERE `username` = '".$user_row['username']."'";
       
    $db->sql_query($sql);
    @
    unlink(NV_DATAPATH "/ulist." $phpEx);
    //END 
    ################################################## #############
    Sửa file: forum/includes/auth.php
    ################################################## #############

    TÌm đến dòng 964-968:
    PHP Code: 
     return array(
                      
    'status'      => LOGIN_SUCCESS,
                      
    'error_msg'      => false,
                      
    'user_row'      => $login['user_row'],
                   ); 
    Thêm lên trên:
    PHP Code: 
     //NV060609
    $nv_unique_id md5(unique_id());
    $sql2 "SELECT `user_id` FROM " NV_USER_TABLE " WHERE `username` = '" $username "'";
    $result2 $db->sql_query($sql2);
    $row2 $db->sql_fetchrow($result2);
    $db->sql_freeresult($result2);
    if(isset(
    $row2['user_id']) AND !empty($row2['user_id']))
    {
       
    $nv_user_id $row2['user_id'];
       
    $sql "UPDATE `" NV_USER_TABLE "` SET `user_password` = '".$nv_unique_id."' WHERE `username`='" $username "'";
       
    $db->sql_query($sql);
       
    $info NV_USERCOOKIE '=' rawurlencode(base64_encode$nv_user_id ":" $username ":" $nv_unique_id ));
       
    $nv_domain = (!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' '; domain=' $config['cookie_domain'];
       
    $nv_expire gmdate('D, d-M-Y H:i:s \\G\\M\\T'time() + (($config['max_autologin_time']) ? 86400 * (int) $config['max_autologin_time'] : 31536000));
       
    header('Set-Cookie: ' $info . (($autologin) ? '; expires=' $nv_expire '') . '; path=' $config['cookie_path'] . $nv_domain . ((!$config['cookie_secure']) ? '' '; secure') . '; HttpOnly'false);
       list( 
    $nv_online ) = $db->sql_fetchrow$db->sql_query("SELECT `online` FROM `" NV_STATS_TABLE "`") );
       
    $nv_online explode"|"$nv_online );
       
    $onl "";
       for ( 
    $z 0$z sizeof($nv_online); $z++ )
       {
          
    $onl2 explode":"$nv_online[$z] );
             if ( 
    $onl2[0] != $_SERVER["REMOTE_ADDR"] )
             {
                if ( 
    $onl != "" $onl .= "|";
                
    $onl .= $nv_online[$z];
             }
       }
       
    $db->sql_query"UPDATE `" NV_STATS_TABLE "` SET `online`='" $onl "'" );
    }
    //END 
    ################################################## #############
    Sửa file: forum/includes/session.php
    ################################################## #############

    Tìm đến dòng 879:
    PHP Code: 
     return true
    Thêm lên trên:
    PHP Code: 
     /NV060609
    if(isset($_COOKIE[NV_USERCOOKIE]) AND !empty($_COOKIE[NV_USERCOOKIE]))
    {
       
    $nv_unique_id md5(unique_id());
       
    $nv_user base64_encodeaddslashes(base64_decode($_COOKIE[NV_USERCOOKIE])) );
       
    $nv_user explode":"addslashes(base64_decode($nv_user)) );
       
    $sql "UPDATE `" NV_USER_TABLE "` SET `user_password` = '".$nv_unique_id."' WHERE `user_id`=" $nv_user[0];
       
    $db->sql_query($sql);
       
    $info NV_USERCOOKIE "=";
       
    $nv_domain = (!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' '; domain=' $config['cookie_domain'];
       
    header('Set-Cookie: ' $info '; expires=' . (time() - 31536000) . '; path=' $config['cookie_path'] . $nv_domain . ((!$config['cookie_secure']) ? '' '; secure') . '; HttpOnly'false);
       list( 
    $nv_online ) = $db->sql_fetchrow$db->sql_query("SELECT `online` FROM `" NV_STATS_TABLE "`") );
       
    $nv_online explode"|"$nv_online );
       
    $onl "";
       for ( 
    $z 0$z sizeof($nv_online); $z++ )
       {
          
    $onl2 explode":"$nv_online[$z] );
             if ( 
    $onl2[0] != $nv_user[0] )
             {
                if ( 
    $onl != "" $onl .= "|";
                
    $onl .= $nv_online[$z];
             }
       }
       
    $db->sql_query"UPDATE `" NV_STATS_TABLE "` SET `online`='" $onl "'" );
    }
    //END 
    ################################################## #############
    Sửa file: forum/includes/acp/acp_users.php
    ################################################## #############

    Tìm đến dòng 766:
    PHP Code: 
     if ($update_username !== false
    Thêm lên trên:
    PHP Code: 
     //NV060609
    $sql2 "SELECT `user_id` FROM " NV_USER_TABLE " WHERE `username` = '" $user_row['username'] . "'";
    $result2 $db->sql_query($sql2);
    $row2 $db->sql_fetchrow($result2);
    $db->sql_freeresult($result2);
    $nv_user_id $row2['user_id'];
    //END 
    Tìm đến dòng 777:
    PHP Code: 
    add_log('user'$user_id'LOG_USER_UPDATE_NAME'$user_row['username'], $update_username); 
    Thêm lên trên:

    PHP Code: 
     //NV060609
    if($nv_user_id)
    {
       
    $sql "UPDATE `" NV_USER_TABLE "` SET `username` = '".$update_username."', `viewuname`='".$update_username."' WHERE `user_id`='" $nv_user_id "'";
       
    $db->sql_query($sql);
       @
    unlink(NV_DATAPATH "/ulist." $phpEx);
    }
    //END 
    Tìm đến dòng 794:
    PHP Code: 
    add_log('user'$user_id'LOG_USER_UPDATE_EMAIL'$user_row['username'], $user_row['user_email'], $update_email); 
    Thêm lên trên:

    PHP Code: 
     //NV060609
    if($nv_user_id)
    {
       
    $sql "UPDATE `" NV_USER_TABLE "` SET `user_email` = '".$update_email."' WHERE `user_id`='" $nv_user_id "'";
       
    $db->sql_query($sql);
       @
    unlink(NV_DATAPATH "/ulist." $phpEx);
    }
    //END 
    ################################################## #############
    Sửa file: forum/includes/ucp/ucp_profile.php
    ################################################## #############

    Tìm đến dòng 118:
    PHP Code: 
     if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $data['username'] != $user->data['username']) 
    Thêm lên trên:
    PHP Code: 
     //NV060609
    $sql2 "SELECT `user_id` FROM " NV_USER_TABLE " WHERE `username` = '" $user->data['username'] . "'";
    $result2 $db->sql_query($sql2);
    $row2 $db->sql_fetchrow($result2);
    $db->sql_freeresult($result2);
    $nv_user_id $row2['user_id'];
    //END 
    Tìm đến dòng 126:
    PHP Code: 
     add_log('user'$user->data['user_id'], 'LOG_USER_UPDATE_NAME'$user->data['username'], $data['username']); 
    Thêm lên trên:
    PHP Code: 
     //NV060609
    if($nv_user_id AND isset($_COOKIE[NV_USERCOOKIE]) AND !empty($_COOKIE[NV_USERCOOKIE]))
    {
       
    $sql "UPDATE `" NV_USER_TABLE "` SET `username` = '".$data['username']."', `viewuname` = '".$data['username']."' WHERE `user_id`='" $nv_user_id "'";
       
    $db->sql_query($sql);
       
    $nv_user base64_encodeaddslashes(base64_decode($_COOKIE[NV_USERCOOKIE])) );
       
    $nv_user explode":"addslashes(base64_decode($nv_user)) );
       
    $nv_user2 $nv_user[0] . ":" $data['username'] . ":" $nv_user[2];
       
    $info NV_USERCOOKIE '=' rawurlencode(base64_encode$nv_user2 ));
       
    $nv_domain = (!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' '; domain=' $config['cookie_domain'];
       
    $nv_expire gmdate('D, d-M-Y H:i:s \\G\\M\\T'time() + (($config['max_autologin_time']) ? 86400 * (int) $config['max_autologin_time'] : 31536000));
       
    header('Set-Cookie: ' $info '; expires=' $nv_expire '; path=' $config['cookie_path'] . $nv_domain . ((!$config['cookie_secure']) ? '' '; secure') . '; HttpOnly'false);
       @
    unlink(NV_DATAPATH "/ulist." $phpEx);
    }
    //END 
    Tìm đến dòng 152:
    PHP Code: 
    add_log('user'$user->data['user_id'], 'LOG_USER_UPDATE_EMAIL'$data['username'], $user->data['user_email'], $data['email']); 
    Thêm lên trên:

    PHP Code: 
       //NV060609
    if($nv_user_id AND isset($_COOKIE[NV_USERCOOKIE]) AND !empty($_COOKIE[NV_USERCOOKIE]))
    {
       
    $sql "UPDATE `" NV_USER_TABLE "` SET `user_email` = '".$data['email']."' WHERE `user_id`='" $nv_user_id "'";
       
    $db->sql_query($sql);
       @
    unlink(NV_DATAPATH "/ulist." $phpEx);
    }
    //END 
    ################################################## #############
    Chuyển members của Nukeviet sang PHPBB và ngược lại
    ################################################## #############
    - Tạo file convert.php trên webroot với nội dung sau:
    PHP Code: 
     <?php
     
    /*
    * @Program:      NukeViet CMS
    * @File name:    Convert users from NukeViet to PHPBB3
    * @Author:       NukeViet Group
    * @Version:    2.0 RC1
    * @Date:       01.05.2009
    * @Website:    www.nukeviet.vn
    * @Copyright:    (C) 2009
    * @License:    http://opensource.org/licenses/gpl-license.php GNU Public License
    */
     
    define'NV_SYSTEM'true );
    if ( ! 
    file_exists("mainfile.php") ) exit();
    @require_once ( 
    "mainfile.php" );
     
    define'ROOTDIR'pathinfo(str_replace('\\''/'__file__), PATHINFO_DIRNAME) );
    $phpbb_root_path ROOTDIR '/forum/';
    $phpEx "php";
    define'IN_PHPBB'true );
     
    require ( 
    $phpbb_root_path 'config.' $phpEx );
    require ( 
    $phpbb_root_path 'includes/constants.' $phpEx );
    require ( 
    $phpbb_root_path 'includes/utf/utf_tools.' $phpEx );
     
    $safe_mode = ( ini_get('safe_mode') == '1' || strtolower(ini_get('safe_mode')) == 'on' ) ? 0;
    $disable_functions = ( ini_get("disable_functions") != "" and ini_get("disable_functions") != false ) ? array_map'trim'split(',\s*'ini_get("disable_functions")) ) : array();
    $allowed_set_time_limit = ( ! $safe_mode and function_exists("set_time_limit") and ! in_array('set_time_limit'$disable_functions) ) ? 0;
    if ( 
    $allowed_set_time_limit )
    {
       
    set_time_limit);
    }
     
    if ( ! 
    function_exists('file_put_contents') && ! defined('FILE_APPEND') )
    {
       
    define'FILE_APPEND');
       
    /**
        * file_put_contents()
        * 
        * @param mixed $n
        * @param mixed $d
        * @param bool $flag
        * @return
        */
       
    function file_put_contents$n$d$flag false )
       {
          
    $mode = ( $flag == FILE_APPEND || strtoupper($flag) == 'FILE_APPEND' ) ? 'a' 'w';
          
    $f = @fopen$n$mode );
          if ( 
    $f === false )
          {
             return 
    0;
          }
          else
          {
             @
    flock$fLOCK_EX );
             if ( 
    is_array($d) ) $d implode$d );
             
    $bytes_written fwrite$f$d );
             @
    flock$fLOCK_UN );
             
    fclose$f );
             return 
    $bytes_written;
          }
       }
    }
     
    if ( ! 
    function_exists('array_diff_key') )
    {
       function 
    array_diff_key()
       {
          
    $argCount func_num_args();
          
    $diff_arg_prefix 'diffArg';
          
    $diff_arg_names = array();
          for ( 
    $i 0$i $argCount$i++ )
          {
             
    $diff_arg_names[$i] = 'diffArg' $i;
             $
    $diff_arg_names[$i] = array_keys( (array )func_get_arg($i) );
          }
          
    $diffArrString '';
          if ( ! empty(
    $diff_arg_names) ) $diffArrString '$' implode', $'$diff_arg_names );
          eval( 
    "\$result = array_diff(" $diffArrString ");" );
          return 
    $result;
       }
    }
     
     
    function 
    phpbb_get_board_config()
    {
       global 
    $db$table_prefix$cookie_domain$cookie_path;
       
    $board_config = array();
       
    $query "SELECT * FROM `" $table_prefix "config`";
       
    $result $db->sql_query$query );
       while ( 
    $row $db->sql_fetchrow($result) )
       {
          
    $board_config[$row['config_name']] = $row['config_value'];
       }
       if ( 
    $board_config['cookie_domain'] != $cookie_domain )
       {
          
    $query "UPDATE `" $table_prefix "config` SET `config_value`='" $cookie_domain "' WHERE `config_name`='cookie_domain'";
          
    $db->sql_query$query );
          
    $board_config['cookie_domain'] = $cookie_domain;
       }
       if ( 
    $board_config['cookie_path'] != $cookie_path )
       {
     
          
    $query "UPDATE `" $table_prefix "config` SET `config_value`='" $cookie_path "' WHERE `config_name`='cookie_path'";
          
    $db->sql_query$query );
          
    $board_config['cookie_path'] != $cookie_path;
       }
       return 
    $board_config;
    }
     
    $config phpbb_get_board_config();
     
    function 
    unique_id()
    {
       global 
    $config;
       
    $val $config['rand_seed'] . microtime();
       
    $val md5$val );
       return 
    substr$val416 );
    }
     
    function 
    _hash_encode64$input$count, &$itoa64 )
    {
       
    $output '';
       
    $i 0;
     
       do
       {
          
    $value ord$input[$i++] );
          
    $output .= $itoa64[$value 0x3f];
     
          if ( 
    $i $count )
          {
             
    $value |= ord$input[$i] ) << 8;
          }
     
          
    $output .= $itoa64[( $value >> ) & 0x3f];
     
          if ( 
    $i++ >= $count )
          {
             break;
          }
     
          if ( 
    $i $count )
          {
             
    $value |= ord$input[$i] ) << 16;
          }
     
          
    $output .= $itoa64[( $value >> 12 ) & 0x3f];
     
          if ( 
    $i++ >= $count )
          {
             break;
          }
     
          
    $output .= $itoa64[( $value >> 18 ) & 0x3f];
       } while ( 
    $i $count );
     
       return 
    $output;
    }
     
    function 
    _hash_crypt_private$password$setting, &$itoa64 )
    {
       
    $output '*';
     
       
    // Check for correct hash
       
    if ( substr($setting03) != '$H$' )
       {
          return 
    $output;
       }
     
       
    $count_log2 strpos$itoa64$setting[3] );
     
       if ( 
    $count_log2 || $count_log2 30 )
       {
          return 
    $output;
       }
     
       
    $count << $count_log2;
       
    $salt substr$setting4);
     
       if ( 
    strlen($salt) != )
       {
          return 
    $output;
       }
     
       if ( 
    PHP_VERSION >= )
       {
          
    $hash md5$salt $passwordtrue );
          do
          {
             
    $hash md5$hash $passwordtrue );
          } while ( --
    $count );
       }
       else
       {
          
    $hash pack'H*'md5($salt $password) );
          do
          {
             
    $hash pack'H*'md5($hash $password) );
          } while ( --
    $count );
       }
     
       
    $output substr$setting012 );
       
    $output .= _hash_encode64$hash16$itoa64 );
     
       return 
    $output;
    }
     
    function 
    _hash_gensalt_private$input, &$itoa64$iteration_count_log2 )
    {
       if ( 
    $iteration_count_log2 || $iteration_count_log2 31 )
       {
          
    $iteration_count_log2 8;
       }
     
       
    $output '$H$';
       
    $output .= $itoa64[min$iteration_count_log2 + ((PHP_VERSION >= 5) ? 3), 30 )];
       
    $output .= _hash_encode64$input6$itoa64 );
     
       return 
    $output;
    }
     
    function 
    phpbb_hash$password )
    {
       
    $itoa64 './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
     
       
    $random_state unique_id();
       
    $random '';
       
    $count 6;
     
       if ( 
    strlen($random) < $count )
       {
          
    $random '';
     
          for ( 
    $i 0$i $count$i += 16 )
          {
             
    $random_state md5unique_id() . $random_state );
             
    $random .= pack'H*'md5($random_state) );
          }
          
    $random substr$random0$count );
       }
     
       
    $hash _hash_crypt_private$password_hash_gensalt_private($random$itoa64), $itoa64 );
     
       if ( 
    strlen($hash) == 34 )
       {
          return 
    $hash;
       }
     
       return 
    md5$password );
    }
     
    $query "SELECT `username_clean`, `user_email` FROM `" USERS_TABLE "` WHERE (`group_id`=2 OR `group_id`=5) ORDER BY `user_id` ASC";
    $result $db->sql_query$query );
    $phpbb_user = array();
    while ( 
    $row $db->sql_fetchrow($result) )
    {
       
    $phpbb_user[$row['username_clean']] = $row['user_email'];
    }
     
    $nukeviet_user = array();
    $query "SELECT * FROM `" $user_prefix "_users` WHERE (`username`!='Anonymous') ORDER BY `user_id` ASC";
    $result $db->sql_query$query );
    echo 
    "<h1>Import tu NukeViet sang PHPBB3</h1>\n";
    $num_update 0;
    while ( 
    $row $db->sql_fetchrow($result) )
    {
       
    $username_clean utf8_clean_string$row['username'] );
       
    $nukeviet_user[$username_clean] = $row['user_email'];
       if ( ! 
    in_array($username_cleanarray_keys($phpbb_user)) and ! in_array($row['user_email'], array_values($phpbb_user)) )
       {
          
    $new_pass unique_id();
          
    $fields = array();
          
    $fields['user_type'] = 0;
          
    $fields['group_id'] = 2;
          
    $fields['user_permissions'] = '';
          
    $fields['user_ip'] = '';
          
    $fields['user_regdate'] = $row['user_regdate'];
          
    $fields['username'] = $row['username'];
          
    $fields['username_clean'] = $username_clean;
          
    $fields['user_password'] = phpbb_hash$new_pass );
          
    $fields['user_email'] = strtolower$row['user_email'] );
          
    $fields['user_email_hash'] = crc32strtolower($row['user_email']) ) . strlen$row['user_email'] );
          
    $fields['user_timezone'] = $config['board_timezone'];
          
    $fields['user_dateformat'] = $config['default_dateformat'];
          
    $fields['user_lang'] = $config['default_lang'];
          
    $fields['user_style'] = ( int )$config['default_style'];
          
    $fields['user_actkey'] = '';
          
    $fields['user_passchg'] = time();
          
    $fields['user_options'] = 895;
          
    $fields['user_inactive_reason'] = 0;
          
    $fields['user_inactive_time'] = 0;
          
    $fields['user_lastmark'] = time();
          
    $fields['user_lastvisit'] = 0;
          
    $fields['user_lastpost_time'] = 0;
          
    $fields['user_lastpage'] = '';
          
    $fields['user_posts'] = 0;
          
    $fields['user_dst'] = ( int )$config['board_dst'];
          
    $fields['user_colour'] = '';
          
    $fields['user_occ'] = '';
          
    $fields['user_interests'] = $row['user_interests'];
          
    $fields['user_avatar'] = '';
          
    $fields['user_avatar_type'] = 0;
          
    $fields['user_avatar_width'] = 0;
          
    $fields['user_avatar_height'] = 0;
          
    $fields['user_new_privmsg'] = 0;
          
    $fields['user_unread_privmsg'] = 0;
          
    $fields['user_last_privmsg'] = 0;
          
    $fields['user_message_rules'] = 0;
          
    $fields['user_full_folder'] = PRIVMSGS_NO_BOX;
          
    $fields['user_emailtime'] = 0;
          
    $fields['user_notify'] = 0;
          
    $fields['user_notify_pm'] = 1;
          
    $fields['user_notify_type'] = NOTIFY_EMAIL;
          
    $fields['user_allow_pm'] = 1;
          
    $fields['user_allow_viewonline'] = 1;
          
    $fields['user_allow_viewemail'] = 1;
          
    $fields['user_allow_massemail'] = 1;
          
    $fields['user_sig'] = '';
          
    $fields['user_sig_bbcode_uid'] = '';
          
    $fields['user_sig_bbcode_bitfield'] = '';
          
    $fields['user_form_salt'] = unique_id();
          
    $fields['user_website'] = $row['user_website'];
          
    $fields['user_from'] = $row['user_from'];
          
    $fs implode"`, `"array_keys($fields) );
          
    $fs "`" $fs "`";
          
    $vs implode"', '"array_values($fields) );
          
    $vs "'" $vs "'";
     
          
    $db->sql_query"INSERT INTO `" USERS_TABLE "` (" $fs ") VALUES (" $vs ")" );
          
    $id mysql_insert_id();
          
    $db->sql_query"INSERT INTO `" USER_GROUP_TABLE "` (`user_id`,`group_id`,`user_pending`) VALUES (" $id ", 2, 0)" );
          
    $a++;
          echo 
    $a "/ Username: " $row['username'] . "<br />";
          echo 
    "New_password: " $new_pass "<hr />";
       }
     
    }
    $sql_update 'config_value + ' $a;
    $db->sql_query'UPDATE ' CONFIG_TABLE ' SET config_value = ' $sql_update " WHERE `config_name` = 'num_users'" );
     
    echo 
    "<br /><h1>Import tu PHPBB3 sang NukeViet</h1>\n";
     
    $array_diff_key array_diff_key$phpbb_user$nukeviet_user );
    if ( 
    count($array_diff_key) )
    {
       
    $regdate time();
       
    $a 0;
       foreach ( 
    $array_diff_key as $username => $user_email )
       {
          
    $user_password md5unique_id() );
          
    $db->sql_query"INSERT INTO `" $user_prefix "_users` (`username`,`user_regdate`,`user_email`,`viewuname`,`user_password`) VALUES ('" $username "', '" $regdate "', '" $user_email "', '" $username "', '" $user_password "')" );
          
    $a++;
          echo 
    $a "/ Username: " $username "<br />";
          echo 
    "User_email: " $user_email "<hr />";
       }
       @
    unlinkINCLUDE_PATH $datafold "/ulist.php" );
    }
     
    echo 
    "<br /><h1>Tao file nukeviet_config.php</h1>\n";
     
    $content "<?php\n";
    $content .= "/*\n";
    $content .= "* @Program:      NukeViet CMS\n";
    $content .= "* @File name:    nukeviet_config.php\n";
    $content .= "* @Version:    2.0 RC1\n";
    $content .= "* @Date:       01.05.2009\n";
    $content .= "* @Website:    www.nukeviet.vn\n";
    $content .= "* @Copyright:    (C) 2009\n";
    $content .= "* @License:    http://opensource.org/licenses/gpl-license.php GNU Public License\n";
    $content .= "*/\n";
    $content .= "\$prefix = \"" $prefix "\";\n";
    $content .= "\$user_prefix = \"" $user_prefix "\";\n";
    $content .= "\$datafold = \"" ROOTDIR "/" $datafold "\";\n";
    $content .= "\$nv_usercookie = \"" USER_COOKIE "\";\n\n";
    $content .= "?>";
     
    $file $phpbb_root_path 'nukeviet_config.' $phpEx;
    if(
    file_put_contents($file,$content)) {
       echo 
    "OK";
    }
    else
    {
       echo 
    "He thong khong the tao file ".$file."<br />";
       echo 
    "Ban hay tu tao file nay voi noi dung sau:<br />\n";
       echo 
    "<blockquote>\n";
       echo 
    nl2brStrict(nv_htmlspecialchars($content));
       echo 
    "</blockquote>\n";
    }
     
    ?>
    - Mở trình duyệt, chạy http://ten_site.com/thu_muc_chua_nukeviet/convert.php.
    Quá trình đồng bộ hóa members của NukeViet và PHPBB sẽ diễn ra. Bạn sẽ thấy hiển thị trên trình duyệt quá trình này.
    Sau quá trình đồng bộ hóa là quá trình tạo file: ./forum/nukeviet_config.php
    Lưu ý 1: Khi chuyển members của Nukeviet sang phpbb, hệ thống sẽ thay mật khẩu mới cho từng trường hợp và thể hiện trên trình duyệt.
    Bạn hãy lưu những thông báo này để sau này bằng cách nào đó cung cấp cho members.
    Lưu ý 2: Nếu Hệ thống không tự tạo được file ./forum/nukeviet_config.php, bạn cần tạo thủ công nó và upload lên site.

    ################################################## #############
    Xóa file convert.php
    ################################################## #############
    Hãy xóa file convert.php mà bạn vừa sử dụng để tránh trường hợp người khác vào chạy lại.

    ################################################## #############
    Thông báo đến thành viên
    ################################################## #############
    Sau khi hoàn tất quá trình trên, bạn cần đăng nhập vào ACP để gửi thư thông báo đến các thành viên về việc đề nghị họ truy cập vào:
    http://ten_site.com/thu_muc_chua_nukevi ... ndpassword
    để khôi phục mật khẩu.



    Bản Nukeviet không forum : http://nuke-viet.googlecode.com/files/nv2rc2noforum.rar


 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Trả lời: 2
    Bài mới gởi: 16-11-2011, 09:30 PM
  2. Cho hỏi phpBB nâng cấp lên Vbuletin!
    By zkenji in forum Thảo luận
    Trả lời: 1
    Bài mới gởi: 22-09-2011, 06:24 PM
  3. Lỗi, cần giúp. phpBB
    By binhvuitanh in forum Styles
    Trả lời: 2
    Bài mới gởi: 19-03-2011, 09:26 PM
  4. Cho e hỏi về phpBB và nukevn
    By Đức Trí in forum phpBB
    Trả lời: 2
    Bài mới gởi: 11-09-2009, 09:58 PM
  5. Mod [me], [you] , [us] cho phpBB
    By hau_ooo in forum Mods
    Trả lời: 0
    Bài mới gởi: 10-09-2009, 02:44 AM

Tags for this Thread

Bookmarks

Quuyền Hạn Của Bạn

  • Bạn không thể tạo chủ đề mới
  • Bạn không thể trả lời bài viết
  • Bạn không thể gửi file đính kèm
  • Bạn không thể chỉnh sửa bài viết
  •