Andy_87 Posted March 6, 2009 Share Posted March 6, 2009 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 Quote Link to comment Share on other sites More sharing options...
kickstart Posted March 6, 2009 Share Posted March 6, 2009 Hi Looks like it has failed to find the php script file, and so when you have tried to use a function in it, it has gone bang. Odd thing is that it is looking at /home/strato/www/bi/www.bitchaboutanything.co.uk/htdocs/forum/ . Firstly not that common for people to have their web site in a directory named with their full web address (including the www and the .co.uk). Is /home/strato/www/bi/www.bitchaboutanything.co.uk/htdocs/ the location of your phpBB install? It is looking for "common.php" there, but I would expect that to be is /mnt/web1/21/84/52021484/htdocs/bitch/tpl/ phpBB stores some config stuff on tables, and can sometimes get confused if you have an install on a production server and then copy it to a local PC (ie, you land up logging on fine to a local version, but redirected to the production version). All the best Keith All the best Keith Quote Link to comment Share on other sites More sharing options...
Andy_87 Posted March 6, 2009 Author Share Posted March 6, 2009 Hi Keith, Yes, "/home/strato/www/bi/www.bitchaboutanything.co.uk/htdocs/forum/" is the exact path where phpBB is installed. There are 3 domains managed from my account, and all three have the same path (apart from the domain is changed in the path). When putting the 'main.php' in the root dir and using the same code as posted, it works fine. It just has a problem finding the 'common.php' script when the 'main.php' is in the '/tpl/' dir. Andy Quote Link to comment Share on other sites More sharing options...
kickstart Posted March 6, 2009 Share Posted March 6, 2009 Hi Any reason you want a php script in a template directory? Appears that Sorry, I have mainly used phpBB2 (and also used it in a similar way to make use of its security), and the templates have just been that. No php in them. All the best Keith Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.