PHP

Register PHPBB With PHP


If you have a website that has a normal website, and then a PHPbb forum you will need this blog to get users from the normal website, and register for PHPbb without creating multiple accounts, and all in one script. First, you must have a normal html form that goes to a PHP file for registering your users (Register Page). This snippet will be easy to install, insert it right under your MySQL insert query for new users. This works with phpbb 3+.

Users to PHPbb auto register

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$password = $_POST['password'];   // do not encrypt the variable for password yet.
$email = $_POST['email'];   //your form post of email
$name = $_POST['username'];   //form post of the username
 
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forums/';     //change /forums/ to your directory folder for phpbb. From current directory, leave ./ in beginning
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
$data = array();
$data['username'] = $name;    //the username gets in the array
$data['user_password'] = phpbb_hash($password);     //password goes encrpted by PHPbb
$data['user_email'] = $email;     //user email gets in the array
$data['group_id'] = '2';       //make your group id of a normal user. default is 2
$data['user_type'] = USER_NORMAL;
 
user_add($data);  //adding user to phpbb database

View Comments
There are currently no comments.