Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何为phpbb制作登记表_Php_Forms_Phpbb - Fatal编程技术网

如何为phpbb制作登记表

如何为phpbb制作登记表,php,forms,phpbb,Php,Forms,Phpbb,我想知道是否有人能帮我做一份phpbb的登记表。我需要一个网站,我正在做这个,客户不希望有两个不同的帐户为同一个人 所以我研究了一下,发现了函数add\u user(),但我不知道如何使用它。我也在phpbb论坛上问过,他们所做的只是让我在wiki页面上找到这个功能,这同样对我毫无帮助 所以,如果有人知道如何使用它,或者知道如何制作类似的教程,请帮助我 像这样使用它 <?php define('IN_PHPBB', true); $phpbb_root_path = (defined('P

我想知道是否有人能帮我做一份phpbb的登记表。我需要一个网站,我正在做这个,客户不希望有两个不同的帐户为同一个人

所以我研究了一下,发现了函数
add\u user()
,但我不知道如何使用它。我也在phpbb论坛上问过,他们所做的只是让我在wiki页面上找到这个功能,这同样对我毫无帮助

所以,如果有人知道如何使用它,或者知道如何制作类似的教程,请帮助我

像这样使用它

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

$user_row = array(
        'username'                      => "his username",
        'user_password'                 => phpbb_hash("new_password"),
        'user_email'                    => "mail@ofuser.com",
        'group_id'                      => 2,
        'user_timezone'                 => 1,
        'user_dst'                      => 1,
        'user_lang'                     => "en",
        'user_type'                     => 0,
        'user_actkey'                   => "",
        'user_ip'                       => "",
        'user_regdate'                  => time(),
        'user_inactive_reason'          => 0,
        'user_inactive_time'            => 0,
);
user_add($user_row, $cp_data);
像这样使用它

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

$user_row = array(
        'username'                      => "his username",
        'user_password'                 => phpbb_hash("new_password"),
        'user_email'                    => "mail@ofuser.com",
        'group_id'                      => 2,
        'user_timezone'                 => 1,
        'user_dst'                      => 1,
        'user_lang'                     => "en",
        'user_type'                     => 0,
        'user_actkey'                   => "",
        'user_ip'                       => "",
        'user_regdate'                  => time(),
        'user_inactive_reason'          => 0,
        'user_inactive_time'            => 0,
);
user_add($user_row, $cp_data);

user\u add使用起来非常简单。但是在使用它之前,您需要检查输入的有效性。例如,检查用户是否已存在

这是我建造的。这将处理提交用户名、电子邮件和密码的表单:

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '/forum/';

$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

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

//Do something here to retrieve get/post variables 

// Validate input
$invalid_username = validate_username($username);
$invalid_email = validate_email($email);
$invalid_password = validate_password($password);
if($invalid_username || $invalid_password || $invalid_email){ //handle error
}

//Build user_row array
$user_row = array(
    'username'              => $username,
    'user_password'         => phpbb_hash($password),
    'user_email'            => $email,
    'group_id'              => 2,
    'user_lang'             => 'en_us',
    'user_type'             => USER_NORMAL,
    'user_ip'               => $user->ip,
    'user_regdate'          => time(),
);

//register and handle error
$user_id = user_add($user_row);
if ($user_id === false){
    //handle error
}    

用户添加非常简单易用。但是在使用它之前,您需要检查输入的有效性。例如,检查用户是否已存在

这是我建造的。这将处理提交用户名、电子邮件和密码的表单:

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '/forum/';

$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

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

//Do something here to retrieve get/post variables 

// Validate input
$invalid_username = validate_username($username);
$invalid_email = validate_email($email);
$invalid_password = validate_password($password);
if($invalid_username || $invalid_password || $invalid_email){ //handle error
}

//Build user_row array
$user_row = array(
    'username'              => $username,
    'user_password'         => phpbb_hash($password),
    'user_email'            => $email,
    'group_id'              => 2,
    'user_lang'             => 'en_us',
    'user_type'             => USER_NORMAL,
    'user_ip'               => $user->ip,
    'user_regdate'          => time(),
);

//register and handle error
$user_id = user_add($user_row);
if ($user_id === false){
    //handle error
}    

为什么不查看phpbb源代码,看看函数在做什么?提取相关位和/或找出如何将phpbb的库包含到您的应用程序中应该不会太难。@Mitchel:请努力用正确的英语书写,使用正确的大写字母等。人们发明换行符也是有原因的。除了让你的眼睛更容易看,你的问题也会得到更多的答案。为什么不看看phpbb源代码,看看函数在做什么?提取相关位和/或找出如何将phpbb的库包含到您的应用程序中应该不会太难。@Mitchel:请努力用正确的英语书写,使用正确的大写字母等。人们发明换行符也是有原因的。除了让你的眼睛看起来更容易,你的问题也会得到更多的答案。