2011-08-25 166 views
0

我要去到phpBB的註冊系統,我自己的網站REG系統集成.. 這裏是代碼問題。中文登錄系統集成

<?php 
require_once("includes/functions.php"); 


$last_id = $_GET['id']; 
$usr = decrypt($_GET['variable1']); 
$passwd = decrypt($_GET['variable2']); 
$em = decrypt($_GET['variable3']); 

//echo 'last id: '.$last_id.' usr: '.$usr.' passwd: '.$passwd.' em: '.$em; 
//exit(); 


define('IN_PHPBB', true); 
/* set scope for variables required later */ 
global $phpbb_root_path; 
global $phpEx; 
global $db; 
global $config; 
global $user; 
global $auth; 
global $cache; 
global $template; 

# your php extension 
$phpEx = substr(strrchr(__FILE__, '.'), 1); 
$phpbb_root_path = 'forum/'; 

/* includes all the libraries etc. required */ 
require($phpbb_root_path ."common.php"); 
//$user->session_begin(); 
//$auth->acl($user->data); 

/* the file with the actual goodies */ 
require($phpbb_root_path ."includes/functions_user.php"); 

/* All the user data (I think you can set other database fields aswell, these seem to be required)*/ 

$user_row = array(
'username' => $usr, 
'user_password' => md5($passwd), 
'user_email' => $em, 
'group_id' => 2/*$default_group_id*/, 
'user_timezone' => '5.00', 
'user_dst' => 0, 
'user_lang' => 'en', 
'user_type' => '0', 
'user_actkey' => "", 
'user_dateformat' => 'd M Y H:i', 
'user_style' => '', 
'user_regdate' => time(), 
); 

/* Now Register user */ 
$phpbb_user_id = user_add($user_row); 
if(!empty($phpbb_user_id)) { 
    echo 'success'; 
    //redirect_to("register_status.php?id={$last_id}"); 
} else { 
    echo 'Error'; 
} 

錯誤是文件utf_normalizer.php找不到。

回答

1

我從錯誤中猜測您已將phpBB的functions.php複製到網站的另一部分?這不起作用,因爲它鏈接到包含路徑中的其他幾個文件。例如,在登錄過程中使用utf_normalizer.php來清除我們的用戶名的非英文字符,以便於比較。

查看Sessions Integration頁面,在phpbb.com上查看已有的工作解決方案。

+0

感謝您的回答,實際上我只是在自己的網站上覆制了代碼。我已經完成了這個通過使用這個代碼畢竟 – Bilal