I got my problem solved ;)
So, on the top of my login.php file, which is outside of the forum directory (phpBB3/) and on my normal website, I put the following code:
Code:
<?php
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);
if($user->data['is_registered']){
redirect("$phpbb_root_path");
break;
}
?>
I was basically missing the:
Code:
if($user->data['is_registered']){
redirect("$phpbb_root_path");
break;
which signifies if the user is registered, then clicking on the forum button links directly to the forum index, bypassing the login page.
On the same login.php in the body, I put the following code:
Code:
<h2>Login Panel</h2>
<?php
/*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("<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(" <input type='text' name='username' size='15' value=''>");
echo("<br /><br />");
echo(" Password:");
echo(" <input type='password' name='password' size='15' value=''>");
echo("<br /><br />");
echo("<input type='submit' name='login' value='Login'>");
echo("<br /></form>");
echo("<br />");
echo("Don't have an account? Please register <a href='phpBB3/ucp.php?mode=register'>here</a>.");
}
/*End Login Box*/
?>
This contains all the forms for the username/password plus a register link on the bottom.
Most of the code has been copied from codes already posted in the phpBB3 Support Forum. I hope that whoever plans to implement an external login panel in their website will find this useful.
Edit:
I also forgot an important piece that I forgot to mention....:happysad:
On line 95 in the ucp.php file under your phpBB3 directory, replace
Code:
meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")));
with
Code:
## LOGOUT REDIRECT HACK -- BEGIN ##
$redirect = request_var('redirect', "../index.html");
meta_refresh(3, append_sid($redirect));
## LOGOUT REDIRECT HACK -- END ##
Logging out of the forum redirects the user back to the homepage (or replace ../index.html with whatever page you want).
Hope this helps.