I'm trying to build a website around phpBB, using the authentication and session management, but I keep getting errors. I would be greatful if somebody could look at the following code and explain the problem.
The include code etc.
//Including the common.php
define('IN_PHPBB', true);
$phpbb_root_path = $_SERVER['DOCUMENT_ROOT']."/forum/";
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
//Session Management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
//To display username of logged in person
$username = $user->data['username'];
The code to determine whether the user is logged in, if logged in display a welcome message, if not, will display login form.
<?
if($user->data['is_registered']){
//Echo following if the user is logged in:
echo "Hello ".$username.", Get Bitching!";
} else {
//If the user isn't logged in, show them the form so they can log in:
echo '
<form method="POST" action="/forum/ucp.php?mode=login">
<p>
<font face="Verdana">Username:
<input type="text" name="username" size="21" style="font-family: Verdana; font-size: 10px; border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; background-color:#CCCCCC"><br>
Password:
<input type="password" name="password" size="21" style="font-family: Verdana; font-size: 10px; border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; background-color:#CCCCCC"><br>
<input type="checkbox" name="autologin" value="ON" style="font-size: 10px">
<sup><font size="2">Remember me</font></sup>
<input value="submit" border="0" src="images/login.jpg" name="login" width="70" height="20" type="image"><br>
<a href="http://www.bitchaboutanything.co.uk/forum/ucp.php?mode=sendpassword">Forgot Password</a> |
<a href="http://www.bitchaboutanything.co.uk/forum/ucp.php?mode=register">Register</a></font></p>
</form>';
}
?>
The erros that gets displayed when loaded:
Warning: include(/home/strato/www/bi/www.bitchaboutanything.co.uk/htdocs/forum/common.php) [function.include]: failed to open stream: No such file or directory in /mnt/web1/21/84/52021484/htdocs/bitch/tpl/main.php on line 6
Warning: include() [function.include]: Failed opening '/home/strato/www/bi/www.bitchaboutanything.co.uk/htdocs/forum/common.php' for inclusion (include_path='.:/opt/RZphp5/includes') in /mnt/web1/21/84/52021484/htdocs/bitch/tpl/main.php on line 6
Fatal error: Call to a member function session_begin() on a non-object in /mnt/web1/21/84/52021484/htdocs/bitch/tpl/main.php on line 9
I would greatly appreciate your help.
Thanks