View Full Version : Why do my phpBB sessions reset?

07-27-2012, 08:19 PM
I have a website in the root of my hosting package with my phpbb forum in the /forum directory.

Here is the link to the site: http://www.alphakravmagainternational.com/index2.php

Test the login with Username: testme , Pass: testme123

I am attempting to establish a phpbb session on my website using the following codes:

This code is included before the <HTML> of every page:

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management

// check for logout request
$cp = $_GET['cp'];
// is it a logout? then kill the session!
if ($cp == "logout") {
echo "Successfully Logged Out.";

My login form in the header of every page:

// Page login notice
if ($user->data['user_id'] == ANONYMOUS)
<img src="forum/images/avatars/gallery/noavatar.png" style="float:left; width:72px; height:72px;">
<div class="login">
<form method="POST" action="forum/ucp.php?mode=login">
<ul><li><span>Username:</span> <input class="loginfield" type="text" name="username" size="20"></li>
<li><span>Password:</span> <input class="loginfield" type="password" name="password" size="20"></li>
<li>Remember Me? <input type="checkbox" name="autologin"> &nbsp; &nbsp; &nbsp; <a href="forum/ucp.php?mode=register">Register</a></li>
<li><input type="submit" value="Login" name="login"></li>
<input type="hidden" name="redirect" value="index.php">

} else { ?>

<img src="forum/images/avatars/gallery/<?php echo $user->data['user_avatar']; ?>" style="float:left; width:72px; height:72px;">
<div class="login">
Welcome back, <?php echo $user->data['username_clean']; ?><br>
You have <?php echo $user->data['user_unread_privmsg']; ?> new messages<br>
<a href="index2.php?cp=logout">Log Out</a>
<?php } ?>

It looks like I am able to log in, however, when I click to a different page the session is gone and I have to log in again. This happens when I click to the forum as well. I cant for the life of me figure this out and It's driving me crazy. Please help!

Thank you for reading.

07-28-2012, 12:47 AM
Phpbb is a very large and complex program. You won't get detailed support for it here however their own forums WILL be able to help you - goto their website and then register on their own forums and repost your question. No-one here will know phpbb in depth enough to help you I'm afraid.