At the head of your page, you need
Code: Select all
define('IN_PHPBB', true);
define('PHPBB_ROOT_PATH', './phpBB3/');
$phpbb_root_path = 'phpBB3/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
Code: Select all
/* Start Logout*/
if ($user->data['is_registered']){
echo("<form method='post' action='".$phpbb_root_path."ucp.php?mode=logout&sid=".$user->data['session_id']."'>");
echo("<input type='submit' name='logout' value='Logout'>");
echo("<input type='hidden' name='redirect' value='../index.php'>");
echo("<br /></form>");
}
/*End Logout*/
/*Start Login Box*/
if (!$user->data['is_registered']){
echo("form method='post' action='".$phpbb_root_path."ucp.php?mode=login'>");
echo(" Username:");
echo("<br />");
echo(" <input type='text' name='username' size='15' value=''>");
echo("<br /><br />");
echo(" Password:");
echo("<br />");
echo(" <input type='password' name='password' size='15' value=''>");
echo("<br /><br />");
echo("<input type='submit' name='login' value='Login'>");
echo("<input type='hidden' name='redirect' value='../".$_SERVER['PHP_SELF']."'>");
echo("<br /></form>");
}
/*End Login Box*/
The redirect bit in the login box takes the user back to the page they logged in from no matter where it is on the website.
You could do the same with the logout of needed