Dyno Posted April 19, 2007 Share Posted April 19, 2007 On my website i have a login username/password box i have it when you enter your login details it'll log you into the forums. When no ones loged in theres no problems but when someone logs in i get the error on my index page Warning: Cannot modify header information - headers already sent by (output started at /home/adaminc/public_html/index-test.php:5) in /home/adaminc/public_html/forums/includes/sessions.php on line 254 Warning: Cannot modify header information - headers already sent by (output started at /home/adaminc/public_html/index-test.php:5) in /home/adaminc/public_html/forums/includes/sessions.php on line 255 On my sessions.php file those 2 lines are Line 254 setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure); Line 255 is blank On my index-test.php file the php code is <?php define('IN_PHPBB', true); $phpbb_root_path = 'forums/'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); $userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length); init_userprefs($userdata); if(!$userdata['session_logged_in']) { echo ' '; ?> <form method="post" action="forums/login.php"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">Username: <input class="post" type="text" name="username" size="12" style="font-family: Arial; font-size: 10px; border: 1px solid #808080"/><br> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">Password: <input class="post" type="password" name="password" size="7" style="font-family: Arial, font-size: 10px; border: 1px solid #808080"/> <br>Remember Me: <input class="text" type="checkbox" name="autologin" /> <input type="submit" class="mainoption" name="login" value="Log in" style="border: 1px solid #333333; font-family:Arial; font-size:10px; color:#000000; text-transform:uppercase; background-color:#E9E9E9" /> <br> <font size="1" face="verdana, Arial, Helvetica, sans-serif"> <img src="forums/templates/DustyGreen/images/icon_mini_search.gif" border="0" align="middle"> <a href="forums/search.php">Search</a> <img src="forums/templates/DustyGreen/images/icon_mini_register.gif" border="0" align="middle"> <a href="forums/profile.php?mode=register">Register</a></font> </form> <?php } else { echo '<font size="2" face="Arial, verdana, Helvetica, sans-serif">Hi, '.$userdata['username'] ; echo '</font><br><font size="1" face="Arial, verdana, Helvetica, sans-serif">'; echo '<img src="forums/images/folder.gif" border="0" align="middle"> <a href="'.append_sid("forums/privmsg.php?folder=inbox").'" title="Private Messages">Inbox</a> ['.$userdata['user_new_privmsg'].']'; echo ' <img src="forums/images/icon_mini_profile.gif" border="0" align="middle"> <a href="'.append_sid("forums/profile.php?mode=editprofile").'" title="Edit profile">Profile</a><br>'; echo '<img src="forums/images/icon_mini_search.gif" border="0" align="middle"> <a href="'.append_sid('forums/search.php').'">'.$lang['Search'].'</a>'; echo ' <img src="forums/images/icon_mini_search_new.gif" border="0" align="middle"> <a href="'.append_sid('forums/search.php?search_id=newposts').'">'.$lang['Last_Post'].'</a><br>'; echo '<img src="forums/images/icon_mini_login.gif" border="0" align="middle"> <a href="'.append_sid('forums/login.'.$phpEx.'?logout=true&sid=' . $userdata['session_id']).'">Logout</a> </font><br>'; } ?> I"m not sure why i'm getting that error if someone can help me fix it i'd be happy thanks. Quote Link to comment https://forums.phpfreaks.com/topic/47785-help-with-webpage-phpbb-login-integration/ Share on other sites More sharing options...
Ninjakreborn Posted April 19, 2007 Share Posted April 19, 2007 http://www.phpclasses.org/browse/package/1532.html I just stumbled across this, and I would probably even use it if I was having some troubles with PHP bb login. Hopefully that will help you come up with something. Quote Link to comment https://forums.phpfreaks.com/topic/47785-help-with-webpage-phpbb-login-integration/#findComment-233445 Share on other sites More sharing options...
Dyno Posted April 19, 2007 Author Share Posted April 19, 2007 Thanks for that it worked great. The only thing i cant get working is the cookie that keeps me logged in. <? class PHPBB_Login { function PHPBB_Login() { } function login( $phpbb_user_id ) { global $db, $board_config; global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID; // Setup the phpbb environment and then // run through the phpbb login process // You may need to change the following line to reflect // your phpBB installation. require_once( './forums/config.php' ); define('IN_PHPBB',true); // You may need to change the following line to reflect // your phpBB installation. $phpbb_root_path = "./forums/"; require_once( $phpbb_root_path . "extension.inc" ); require_once( $phpbb_root_path . "common.php" ); return session_begin( $phpbb_user_id, $user_ip, PAGE_INDEX, FALSE, TRUE ); } function logout( $session_id, $phpbb_user_id ) { global $db, $lang, $board_config; global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID; // Setup the phpbb environment and then // run through the phpbb login process // You may need to change the following line to reflect // your phpBB installation. require_once( './forums/config.php' ); define('IN_PHPBB',true); // You may need to change the following line to reflect // your phpBB installation. $phpbb_root_path = "./forums/"; require_once( $phpbb_root_path . "extension.inc" ); require_once( $phpbb_root_path . "common.php" ); session_end( $session_id, $phpbb_user_id ); // session_end doesn't seem to get rid of these cookies, // so we'll do it here just in to make certain. setcookie( $board_config[ "phpbb2mysql" ] . "_sid", "", time() - 3600, " " ); setcookie( $board_config[ "phpbb2mysql" ] . "_mysql", "", time() - 3600, " " ); } } ?> thats the code used can anyone see where its not working. the cookie name on the forum is phpbb2mysql Quote Link to comment https://forums.phpfreaks.com/topic/47785-help-with-webpage-phpbb-login-integration/#findComment-233619 Share on other sites More sharing options...
Dyno Posted April 20, 2007 Author Share Posted April 20, 2007 Anyone know why it isnt holding the login Quote Link to comment https://forums.phpfreaks.com/topic/47785-help-with-webpage-phpbb-login-integration/#findComment-234205 Share on other sites More sharing options...
Dyno Posted April 21, 2007 Author Share Posted April 21, 2007 i still dont know what i'm doing wrong it should be holding the login but its not Quote Link to comment https://forums.phpfreaks.com/topic/47785-help-with-webpage-phpbb-login-integration/#findComment-234882 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.