I've integrated a phpbb3 forum to my already existing website.
I've been able to make my registration process add the user to the phpbb db as well.
Now i'm facing a problem where I am trying to get the user to auto-login to the forum when he logs in to my website.
Have anyone here done that? I can't find anything relevant on Google as all posts seem to talk about 'phpbb external webpages' and how you can use phpbb sessions on other webpages. however what i'm trying to do is to initiate a login only when the member logs in to my website, and following the tutorials i found on google will let my users log in to my site when they log in to my forum (which is the other way around).
Thanks
<?php
define('IN_PHPBB', true);
$phpbb_root_path = '../phpBB3/'; //the path to your phpbb relative to this script
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include("../phpBB3/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', 'john');
$password = request_var('password', '123');
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']];
}
}
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With