mam problem z integracją logowania phpbb na mojej stronie.
Otóż skorzystałem z waszego skryptu i niestety nie wszystko mi działa.
Logowanie na stronie działa, wpisuje login i pw loguje mnie na forum, jednak gdy wejde na strone to jestem wylogowany i tak za każdym razem, strona tak jakby traci sesje.
Mam nadzieję że da się temu zaradzić.
O to mój początkowy kod:
Kod
<?php
$folder = "/home/clanscri/domains/clanscripts.pl/public_html/";
define('IN_PHPBB', true);
$phpbb_root_path = $folder . 'forum/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.' . $phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
if (!$userdata['session_logged_in']) $userdata['user_level'] = "0";
$redir = '.././' .
str_replace ($folder, "", $_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI']);
?>
$folder = "/home/clanscri/domains/clanscripts.pl/public_html/";
define('IN_PHPBB', true);
$phpbb_root_path = $folder . 'forum/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.' . $phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
if (!$userdata['session_logged_in']) $userdata['user_level'] = "0";
$redir = '.././' .
str_replace ($folder, "", $_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI']);
?>
Logowanie:
Kod
<?php
if ($userdata['user_id'] > 1)
{
echo '<span style="font-weight: bold;">' . $userdata['username'] . '</span><br/>
<a href="http://strona.pl/forum/privmsg.php?folder=inbox">
Prywatne wiadomości: ' . $userdata['user_unread_privmsg'] . '</a><br/>
<a href="http://strona.pl/forum/login.php?logout=true">Wyloguj</a>';
}
else
{
echo '<form action="http://www.forum.clanscripts.pl/login.php" method="post">
<input type="text" name="username" value="" tabindex="1" />
<input type="password" name="password" tabindex="2" />
<br/>
<input type="hidden" name="autologin" value="on"/>
<input type="hidden" name="login" value="Zaloguj"/>
<input type="hidden" name="redirect" value="' . $redir . '"/>
<input type="submit" name="login" value="Login" tabindex="3" />
</form><br/>
<a href="http://strona.pl/forum/profile.php?mode=register">Rejestracja</a>';
}
?>
if ($userdata['user_id'] > 1)
{
echo '<span style="font-weight: bold;">' . $userdata['username'] . '</span><br/>
<a href="http://strona.pl/forum/privmsg.php?folder=inbox">
Prywatne wiadomości: ' . $userdata['user_unread_privmsg'] . '</a><br/>
<a href="http://strona.pl/forum/login.php?logout=true">Wyloguj</a>';
}
else
{
echo '<form action="http://www.forum.clanscripts.pl/login.php" method="post">
<input type="text" name="username" value="" tabindex="1" />
<input type="password" name="password" tabindex="2" />
<br/>
<input type="hidden" name="autologin" value="on"/>
<input type="hidden" name="login" value="Zaloguj"/>
<input type="hidden" name="redirect" value="' . $redir . '"/>
<input type="submit" name="login" value="Login" tabindex="3" />
</form><br/>
<a href="http://strona.pl/forum/profile.php?mode=register">Rejestracja</a>';
}
?>
Dodam ze forum znajduje się w folderze głownym w katalogu /forum - subdomena to forum.clanscripts.pl
Pozdrawiam fuqET.