Ich habe meine Seite die ich getrennt vom Forum betreibe.
Nun habe ich den Login vom Forum benutzt. Hierbei bin ich wie folgt vorgegangen.
In meine index.php (Website) include ich ganz am Anfang test.php
Code: Alles auswählen
//Benötigte Dateien und Variablen von phpBB
define('IN_PHPBB', true);
$phpbb_root_path = '../phpbb/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//Session auslesen und Benutzer-Informationen laden
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
redirect(append_sid("index.php" true));
Code: Alles auswählen
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
if ( $userdata['session_logged_in'] )
{
print'<div align="left">
<a href="module/members/members_admin.php" target="_blank">» Profil Verwaltung</a><br>
<a href="module/" target="_blank">» News Verwaltung</a><br>
<a href="#">» Seiten-Einstellung</a><br>
<a href="#">» Messages</a><br>
<a href="#">» Freunde</a><br><br>';
$siddy = $HTTP_GET_VARS["sid"];
print'<a href="'.$PHP_SELF.'?logout=true&sid='.$siddy.'">» Logout</a><br>
</div>';
print '<form action="../phpbb/login_test.php" name="log_out" method="post">
<input type="hidden" name="logout" value="true">
<input type="hidden" name="redirect" value="../gilde/index.php">
<input type="submit" name="Logout" value="Logout" style="BACKGROUND-COLOR: #F1C46F; COLOR: #A10505; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 9px; border: 2px inset; border-bottom-style: outset; border-left-style: outset; border-right-style: outset; border-top-style: outset; font-weight: bold; border-color: #F1C46F #F1C46F #F1C46F #F1C46F">
</form>';
}
else
{
//echo "User ist nicht angemeldet";
print '<form action="../phpbb/login_test.php" method="post">
<input type="hidden" name="nav" value="'.$nav.'">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle" align="left" class="login">Benutzername: <input type="text" name="username" style="height:18px; width:100px; font-size:8pt;background-color: #F4C279"></td>
</tr>
<tr>
<td valign="middle" align="left" class="login">Passwort: <input type="password" name="password" style="height:18px; width:100px; font-size:8pt;background-color: #F4C279"></td>
</tr>
<tr>
<td valign="middle" align="left" class="login">Autologin? <input type="checkbox" name="autologin"></td>
</tr>
<tr>
<td align="center"><img src="img/spacer.gif" alt="" width="1" height="10" border="0"><br><input type="submit" name="login" value="Login" style="BACKGROUND-COLOR: #F1C46F; COLOR: #A10505; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 9px; border: 2px inset; border-bottom-style: outset; border-left-style: outset; border-right-style: outset; border-top-style: outset; font-weight: bold; border-color: #F1C46F #F1C46F #F1C46F #F1C46F"></td>
</tr>
</table>
<input type="hidden" name="redirect" value="../gilde/index.php">
<input type="hidden" name="redirect" value="../gilde/index.php">
</form>';
}
Soweit ist das auch alles Schön und gut. Login funktioniert.
Nur wie Log ich mich wieder aus? hab es mit einem Link und Formular versucht was bei beiden nur eine Fehlermeldung "
Warning: Cannot modify header information - headers already sent by" bringt. Der Output kommt laut der Fehlermeldung aus der Datei sessions.php on line 188 die ich aber nirgends included habe aber wahrscheinlich passiert das durch die login.php aus dem phpbb.
Hat einer eine Idee wie ich das Problem löse?
Danke schonmal