I'm currently experimenting with integrating PHPBB3's login information across my website.
I managed to get it working last night with being able to display which user is logged in and if they were not offering them a login script.
Nothing is ever simple though as when I tried updating the website this morning, I now get the following error message:
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1024: Cannot modify header information - headers already sent by (output started at /hermes/bosweb/web176/b1764/ipg.teachingictorg/index.php:7)
This is something I have never come accross before and would be interested to know what is causing it. For reference this is my current php code:
In the header (Which would need to be used on each page involved in the intergration):
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './Forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
?>
To follow this up, later in the page I use the following script to alert the user whether they are online or need to log in:
<?php
if($user->data['is_registered'])
//if($user->data['session_logged_in'])
//User is then logged in
{
print $user->data['username'];
echo'<span class="brightgreen"> is logged in</span><br />
<a title="See You Later" href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id). '">Log out</a>';
}
else
//If user is not logged in the following form is displayed
{
echo'<form method="post" action="Forum/ucp.php?mode=login">
<label for="username">Username: </label> <input type="text" name="username" id="username" size="15" /><br /><br />
<label for="password">Password: </label><input type="password" name="password" id="password" size="15" /><br /><br />
<label for="autologin">Remember Me?: </label><input type="checkbox" name="autologin" id="autologin" /><br /><br />
<input type="submit" value="Log In" name="login" /><a title="Register" href="Forum/ucp.php?mode=register"> Register</a>
<input type="hidden" name="redirect" value="index.php" />
</form>';
}
?>