自定义phpbb3注册

时间:2012-12-02 12:52:10

标签: phpbb3

我正在进行自定义phpbb3注册,我正在尝试注册用户表单外部文件,但它无法正常工作。我也检查了错误。没有错误。任何人都可以帮助我解决我的错误。如果有人有任何简单的想法如何为phpbb3添加新的用户记录,请帮我解决这个问题。

 <?php

        $username = $_POST[username];
        $password = $_POST[password];
        $email_address = $_POST[email];


    include('forums/common.php');
    require('forums/includes/functions_user.php');

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup('viewtopic');

        global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;

        $user_row = array(
            'username'                => $username,                //REQUIRED IN FORM
            'user_password'            => md5($password),            //REQUIRED IN FORM
            'user_email'            => $email_address,            //REQUIRED IN FORM
            'group_id'                =>    0,//(int) $group_id,
            'user_timezone'            => $timezone = date(Z) / 3600,//(float) $data[tz],
            'user_dst'                => date(I),//$is_dst,
            'user_lang'                => $user->lang_name,//$data[lang],
            'user_type'                => USER_NORMAL,//$user_type,
            'user_actkey'            => '',//$user_actkey,
            'user_ip'                => $user->ip,
            'user_regdate'            => time(),
            'user_inactive_reason'    => 0,//$user_inactive_reason,
            'user_inactive_time'    => 0,//$user_inactive_time,
        );


    // Register user...
        $user_id = user_add($user_row);

    ?>

1 个答案:

答案 0 :(得分:1)

您必须定义

define('IN_PHPBB', true);

在其他情况下,您的脚本将立即退出common.php和其他所需文件。你可以看到

if (!defined('IN_PHPBB'))
{
    exit;
}

在每个必需的文件中