Code: Select all
<?php
/*$user_row = array(
'username' => "NAME",
'user_password' => "PASSWORD",
'user_email' => "EMAIL",
'group_id' => 2,
'user_type' => 0,
);*/
function NewUser($user_row)
{
global $phpbb_container;
global $phpbb_dispatcher;
global $db, $config;
global $table_prefix;
define('IN_PHPBB', true);
global $phpbb_root_path;
global $phpEx;
$phpbb_root_path = './forum/';
$phpEx = 'php';
include($phpbb_root_path . 'common.php');
include($phpbb_root_path . 'includes/functions_user.php');
return user_add($user_row);
}
?>
Code: Select all
<?php
function HashPassword($Password)
{
global $phpbb_container;
global $phpbb_dispatcher;
global $db, $config;
global $table_prefix;
define('IN_PHPBB', true);
global $phpbb_root_path;
global $phpEx;
$phpbb_root_path = './forum/';
$phpEx = 'php';
include($phpbb_root_path . 'common.php');
include($phpbb_root_path . 'includes/functions_user.php');
$passwords_manager = $phpbb_container->get('passwords.manager');
return $passwords_manager->hash($Password);
}
function NewUser($UserName, $Password, $Email)
{
global $phpbb_container;
global $phpbb_dispatcher;
global $db, $config;
global $table_prefix;
define('IN_PHPBB', true);
global $phpbb_root_path;
global $phpEx;
$phpbb_root_path = './forum/';
$phpEx = 'php';
include($phpbb_root_path . 'common.php');
include($phpbb_root_path . 'includes/functions_user.php');
$passwords_manager = $phpbb_container->get('passwords.manager');
$user_row = array(
'username' => $UserName,
'user_password' => $passwords_manager->hash($Password),
'user_email' => $Email,
'group_id' => 2,
'user_type' => 0,
);
//user_add from 'includes/functions_user.php' which returns userid.
return user_add($user_row);
}
?>