That's more if you want to design a site around the phpBB system, and not just tie two existing systems together.
To use the phpBB sessions, you'll need this code at the top of your file:
Code: Select all
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
To see if a user is logged in:
Code: Select all
if($user->data['is_registered'])
//user is logged in
else
//user is not logged in
For the login redirection, you'll probably need to add a hidden input with the redirect path.
Code: Select all
<input type="hidden" name="redirect" value="index.php">
So a login form would look like this:
Code: Select all
Please log in:<br />
<form method="POST" action="./ucp.php?mode=login">
<p>Username: <input type="text" name="username" size="40"><br />
Password: <input type="password" name="password" size="40"><br />
Remember Me?: <input type="checkbox" name="autologin"><br />
<input type="submit" value="Submit" name="login"></p>
<input type="hidden" name="redirect" value="index.php">
</form>
To show the user's name:
Code: Select all
echo "Welcome back " . $user->data['username'];
You can add custom profile fields through the Users and Groups tab in the admin panel.