Código PHP:
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Register_user extends CI_Controller {
public function __construct() {
require_once('phpbb3/common.php');
require_once('phpbb3/includes/functions_user.php');
require_once('phpbb3/includes/functions_module.php');
parent::__construct();
}
function index() { //Your stuff works as normal now
$this->load->view('login_view');
define('IN_PHPBB', true);
$phpbb_root_path = 'phpbb3/'; // Your path here
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include($phpbb_root_path . 'includes/ucp/ucp_register.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
require($phpbb_root_path . 'includes/functions_user.php');
$username = 'Fais';
$password = 'Fais'; // Do NOT encrypt !
$email = '[email protected]';
$user_row = array(
'username' => $username,
'user_password' => md5($password), 'user_email' => $email,
'group_id' => 2, #Registered users group
'user_timezone' => '1.00',
'user_dst' => 0,
'user_lang' => 'en',
'user_type' => '0',
'user_actkey' => '',
'user_dateformat' => 'd M Y H:i',
'user_style' => 1,
'user_regdate' => time(),
);
$user_id = user_add($user_row);
echo $user_id;
}
}