I've asked this question on phpBB.com but still have not got an answer back. I'm trying to create an external login script as many other others do. I've searchd over phpBB.com and SO without a answer that suffices my problem.
I've borrowed this question from This SO post. I get the message "You're logged in", but when I visit my board I'm not logged in. I'm not sure exactly whats wrong. I apologize if this has been posted somewhere else before.
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './'; //the path to your phpbb relative to this script
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include("./common.php"); ////the path to your phpbb relative to this script
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
$username = request_var('username', 'Username');
$password = request_var('password', 'Password');
if(isset($username) && isset($password))
{
$result=$auth->login($username, $password, true);
if ($result['status'] == LOGIN_SUCCESS) {
echo "You're logged in";
} else {
echo $user->lang[$result['error_msg']];
}
}
?>
This code is posted in the root directory of my forums, so the phpBB root path is correct. I am running 3.0.12, fresh install, no MODs installed.