Jak połączyć logowanie na strone bezposrednio z logowaniem
Jak połączyć logowanie na strone bezposrednio z logowaniem
na forum? Ma ktos jakies pomysly?
Warning: Cannot modify header information - headers already sent by (output started at c:\usr\apache\httpd\html\index.php:3) in c:\usr\apache\httpd\html\forum\includes\sessions.php on line 258
Warning: Cannot modify header information - headers already sent by (output started at c:\usr\apache\httpd\html\index.php:3) in c:\usr\apache\httpd\html\forumincludes\sessions.php on line 259
Wlasciwie wszystko dziala (uzyty kod z podanego wyzej linku), ale te bledy pojawiaja sie na samym poczatku, pozniej po zalogowaniu znikaja. jak sie ich pozbyc?
Warning: Cannot modify header information - headers already sent by (output started at c:\usr\apache\httpd\html\index.php:3) in c:\usr\apache\httpd\html\forumincludes\sessions.php on line 259
Wlasciwie wszystko dziala (uzyty kod z podanego wyzej linku), ale te bledy pojawiaja sie na samym poczatku, pozniej po zalogowaniu znikaja. jak sie ich pozbyc?
To jest caly plik. Nie mam adresu bo robie to lokalnie...narazie przynajemniej.
Po wyrzuceniu tych liniejek z session.php
setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);
(forum/include/session.php), bledow nie mam jak na razie,ale nie wiem co mi nie bedzie dzialalo bez tych ciasteczek.
Po wyrzuceniu tych liniejek z session.php
setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);
(forum/include/session.php), bledow nie mam jak na razie,ale nie wiem co mi nie bedzie dzialalo bez tych ciasteczek.
Kod: Zaznacz cały
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './phpBB2/';
$page_path = 'index.php/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata);
//zmienne odpowiadajace za statsy
$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'];
//koniec zmienne odpowiadajace za statsy poczatek zmienne odp. za logowanie
$scfile=explode("/",$_SERVER['PHP_SELF']);
$redir = "../index.php";
?>
Statystyki:
<?php
echo("Użytkowników: ".$total_users."<br>Postów: ".$total_posts."<br>Ostatnio zarejestrowny: <a href=phpBB2/profile.php?mode=viewprofile&u=".$newest_uid.">".
$newest_user."</A>");
?>
Logowanie:
<?php
//link pierwszy LOGIN
if( $userdata['session_logged_in'] )
{
//powitanie
echo '<center><b>Witaj '.$userdata['username'].'</b></center><br>';
//edytuj profil
echo ' | <A HREF="'.append_sid($phpbb_root_path.'profile.php?mode=editprofile').'">Edytuj profil</A><br>';
//kod odpowiadający za prywatne wiadomosci
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;
}
//link Prywatne Wiadomości
echo ' | <a href="'.append_sid("phpBB2/privmsg.".$phpEx."?folder=inbox") . '" onclick="jump_to_inbox();return false;" target="_new">'.$userdata['user_new_privmsg'].'</a><br>';
//link wyloguj
echo ' | <a href="'.append_sid('phpBB2/login.php?logout=true&redirect='.$redir.'&sid='.$userdata['session_id']).'">Wyloguj</a><br>';
}
//to wszystko jak jesteśmy zalogowani, pokazuje opcje
else
//to wszystko jak nie jesteśmy zalogowni, pokazują sie formularze
{
echo '<center>
<form method="post" action="phpBB2/login.php" STYLE="display: inline" name="login">
<input width="100" height="16" type="text" name="username">
<input width="100" height="16" type="password" name="password">
<input type="hidden" name="redirect" value="../index.php">
<input type=hidden name=login value="login">
<input class="text" type="checkbox" name="autologin">Zamiętaj mnie<br>
<input width="53" height="14" type="submit" value="Zaloguj">
</form>';
//link zarejestruj
echo '<A HREF="'.append_sid($phpbb_root_path.'profile.php?mode=register').'" class=l>Rejestracja</a>';
//link zapomniałem hasła
echo '<A HREF="'.append_sid($phpbb_root_path.'profile.php?mode=sendpassword').'" class=l>Zapomniałem hasło</a>';
}
?>Kod: Zaznacz cały
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './phpBB2/';
$page_path = 'index.php/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata);
//zmienne odpowiadajace za statsy
$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'];
//koniec zmienne odpowiadajace za statsy poczatek zmienne odp. za logowanie
$scfile=explode("/",$_SERVER['PHP_SELF']);
$redir = "../index.php";
?> Kod: Zaznacz cały
<?php
//link pierwszy LOGIN
if( $userdata['session_logged_in'] )
{
//powitanie
echo '<center><b>Witaj '.$userdata['username'].'</b></center><br>';
//edytuj profil
echo ' | <A HREF="'.append_sid($phpbb_root_path.'profile.php?mode=editprofile').'">Edytuj profil</A><br>';
//kod odpowiadający za prywatne wiadomosci
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;
}
//link Prywatne Wiadomości
echo ' | <a href="'.append_sid("phpBB2/privmsg.".$phpEx."?folder=inbox") . '" onclick="jump_to_inbox();return false;" target="_new">'.$userdata['user_new_privmsg'].'</a><br>';
//link wyloguj
echo ' | <a href="'.append_sid('phpBB2/login.php?logout=true&redirect='.$redir.'&sid='.$userdata['session_id']).'">Wyloguj</a><br>';
}
//to wszystko jak jesteśmy zalogowani, pokazuje opcje
else
//to wszystko jak nie jesteśmy zalogowni, pokazują sie formularze
{
echo '<center>
<form method="post" action="phpBB2/login.php" STYLE="display: inline" name="login">
<input width="100" height="16" type="text" name="username">
<input width="100" height="16" type="password" name="password">
<input type="hidden" name="redirect" value="../index.php">
<input type=hidden name=login value="login">
<input class="text" type="checkbox" name="autologin">Zamiętaj mnie<br>
<input width="53" height="14" type="submit" value="Zaloguj">
</form>';
//link zarejestruj
echo '<A HREF="'.append_sid($phpbb_root_path.'profile.php?mode=register').'" class=l>Rejestracja</a>';
//link zapomniałem hasła
echo '<A HREF="'.append_sid($phpbb_root_path.'profile.php?mode=sendpassword').'" class=l>Zapomniałem hasło</a>';
}
?>