Logowanie PhpBB

0

Witajcie, mam pewien drobny problemik: znalazłem skrypt logowania do phpbb, ale czasami wywala on błędy jak np:

Warning: Cannot modify header information - headers already sent by (output started at /home/.../domains/.../public_html/.../index.php:8) in /home/.../domains/.../public_html/forum/includes/sessions.php on line 366

Warning: Cannot modify header information - headers already sent by (output started at /home/.../domains/.../public_html/.../index.php:8) in /home/.../domains/.../public_html/forum/includes/sessions.php on line 367

Skrypt jaki znalazłem to:

<?php
define('IN_PHPBB', true);
$phpbb_root_path = '../forum/';
$page_path = '/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata);
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];
$scfile=explode("/",$_SERVER['PHP_SELF']);
$redir = "../";
if( $userdata['session_logged_in'] )
{
switch( $userdata['user_avatar_type'] ) 
      { 
         case USER_AVATAR_UPLOAD: 
            $avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="../forum/' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'] . '" alt="" />' : ''; 
            break; 
         case USER_AVATAR_REMOTE: 
            $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="../forum/' . $userdata['user_avatar'] . '" alt="" />' : ''; 
            break; 
         case USER_AVATAR_GALLERY: 
            $avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="../forum/' . $board_config['avatar_gallery_path'] . '/' . $userdata['user_avatar'] . '" alt="" />' : ''; 
            break; 
      }
if( $avatar != '' ) 
{ 
   echo '<img src="' . $avatar . '">'; 
}
echo '<center><b>Witaj '.$userdata['username'].'</b></center><br>';
echo '<A HREF="'.append_sid($phpbb_root_path.'profile.php?mode=editprofile').'">Profil</A><br>';
if ( ($userdata['session_logged_in']) && (empty($gen_simple_header)) )
{
if ( $userdata['user_new_privmsg'] )
{
$l_message_new = ( $userdata['user_new_privmsg'] == 1 ) ? $lang['New_pm'] : $lang['New_pms'];
$l_privmsgs_text = sprintf($l_message_new, $userdata['user_new_privmsg']);

if ( $userdata['user_last_privmsg'] > $userdata['user_lastvisit'] )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_last_privmsg = " . $userdata['user_lastvisit'] . "
WHERE user_id = " . $userdata['user_id'];
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update private message new/read time for user', '', __LINE__, __FILE__, $sql);
}

$s_privmsg_new = 1;
$icon_pm = $images['pm_new_msg'];
}
else
{
$s_privmsg_new = 0;
$icon_pm = $images['pm_new_msg'];
}
}
else
{
$l_privmsgs_text = $lang['No_new_pm'];

$s_privmsg_new = 0;
$icon_pm = $images['pm_no_new_msg'];
}

if ( $userdata['user_unread_privmsg'] )
{
$l_message_unread = ( $userdata['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
$l_privmsgs_text_unread = sprintf($l_message_unread, $userdata['user_unread_privmsg']);
}
else
{
$l_privmsgs_text_unread = $lang['No_unread_pm'];
}
}
else
{
$icon_pm = $images['pm_no_new_msg'];
$l_privmsgs_text = $lang['Login_check_pm'];
$l_privmsgs_text_unread = '';
$s_privmsg_new = 0;
}
echo 'PW: <a href="'.append_sid("../forum/privmsg.".$phpEx."?folder=inbox") . '" onclick="jump_to_inbox();return false;" target="_new">'.$userdata['user_new_privmsg'].'</a><br>';
echo '<a href="'.append_sid('../forum/login.php?logout=true&redirect=
'.$redir.'&sid='.$userdata['session_id']).'">Wyloguj</a><br>';

}
else
{
echo '<center><span class="style1">
<form method="post" action="../forum/login.php" STYLE="display: inline" name="login">
Użytkownik:<br>
<input width="100" height="16" type="text" name="username"><br>
Hasło:<br>
<input width="100" height="16" type="password" name="password">
<input type="hidden" name="redirect" value="../forum">
<input type=hidden name=login value="login"><br>
<input class="text" type="checkbox" name="autologin">Zamiętaj mnie<br>
<input width="53" height="14" type="submit" value="Zaloguj"><br>
</span></center></form>';
echo '<A HREF="'.append_sid($phpbb_root_path.'profile.php?mode=register').'" class=l>Rejestracja</a><br>';
echo '<A HREF="'.append_sid($phpbb_root_path.'profile.php?mode=sendpassword').'" class=l> Zapomniałem hasła</a>';
}
?>

Wyświetlam logowanie poprzez inlcude('login.php')
pozdrawiam.

0

spróbuj na początku głównego skryptu dać ob_start(); a na końcu ob_flush();
powinno pomóc

1 użytkowników online, w tym zalogowanych: 0, gości: 1