Проблем с интегриран сайт и форум

ozilinho

Registered
Имам проблем с общ логин.Влизам в сайта(index.php) в логина пиша там потр.име и парола натискам Вход и влизам на акаунта си,но когато натисна на друга страница ме изхвърля от логина.
Ето и кода:

Код:
<?php
  require_once($include_directory . 'forum/config.php');
  function display($string) {
    return htmlspecialchars(stripslashes($string), ENT_QUOTES);
  }

  //stuff to tie into phpbb forums
  define('IN_PHPBB', true);
  $phpbb_root_path = $home_directory . 'forum/';
  $phpEx = substr(strrchr(__FILE__, '.'), 1);
  include($phpbb_root_path . 'common.' . $phpEx);
  // Start session management
  $user->session_begin();
  $auth->acl($user->data);
  $user->setup();
  // end stuff to tie into forums

?>

<div id="login">
<?php
  if($user->data['is_registered']) {
    //User is already logged in
    echo '<span class="white blkbg">Çäðàâåéòå <strong>' . $user->data['username'] . '</strong></span>';
	echo "<br><img src=\"$phpbb_root_path/download/file.php?avatar=".$user->data['user_avatar']."\" alt=\"Âèå íÿìàòå àâàòàð\"/>";
	echo '<br><span class="white blkbg">Íîâè ñúîáùåíèÿ: <strong>' . $user->data['user_new_privmsg'] . '</strong></span>';
	echo '<br><span class="white blkbg">Îáùî ìíåíèÿ: <strong>' . $user->data['user_posts'] . '</strong></span>';
	echo ' <br><a class="small blkbg" href="./index.php" title="logout"> <input type="submit" value="Èçõîä" class="button" name="logout"/></a>';
  }
  else {
    $username = request_var('username', '', true);
    $password = request_var('password', '', true);
    $autologin = (!empty($_POST['autologin'])) ? true : false;

    $result = $auth->login($username, $password, $autologin);

    if ($result['status'] == LOGIN_SUCCESS) {
      //User was successfully logged into phpBB
      $redirect = request_var('redirect', "{$phpbb_root_path}index.$phpEx");
      
      // append/replace SID
      $redirect = reapply_sid($redirect);
      meta_refresh(0, $redirect);
      trigger_error('You have been successfully logged in');
    }
    else {
      //User's login failed
    }
?>
    <form method="post" action="forum/ucp.php?mode=login">
      Ïîòðåáèòåë:<br /><input class="textboxx" type="text" name="username" id="username" size="20" /><br />
      Ïàðîëà:<br /><input class="textbox" type="password" name="password" id="password" size="20"/><br />
           <input type="checkbox" name="autologin" id="autologin"/><span class="white"><strong>Çàïîìíè ìå</strong></span><br />
      <input type="submit" value="Âõîä" class="button" name="login"/><br />
      <input type="hidden" name="redirect" value="<?php echo $_SERVER['PHP_SELF']?>"/>
    </form>
<?php
  }
?>
</div>

Ако има някъде грешки кажете
 
Както съм дал кода по-горе и така е сложен в сайта.
Тази част от кода трябва ли да сложа преди <html>
Код:
<?php
  require_once($include_directory . 'forum/config.php');
  function display($string) {
    return htmlspecialchars(stripslashes($string), ENT_QUOTES);
  }

  //stuff to tie into phpbb forums
  define('IN_PHPBB', true);
  $phpbb_root_path = $home_directory . 'forum/';
  $phpEx = substr(strrchr(__FILE__, '.'), 1);
  include($phpbb_root_path . 'common.' . $phpEx);
  // Start session management
  $user->session_begin();
  $auth->acl($user->data);
  $user->setup();
  // end stuff to tie into forums

?>
или може да е заедно цялото,защото е заедно и стои някъде в средата на сайта.
 
Код:
<?php
  require_once($include_directory . 'forum/config.php');
  function display($string) {
    return htmlspecialchars(stripslashes($string), ENT_QUOTES);
  }

  //stuff to tie into phpbb forums
  define('IN_PHPBB', true);
  $phpbb_root_path = $home_directory . 'forum/';
  $phpEx = substr(strrchr(__FILE__, '.'), 1);
  include($phpbb_root_path . 'common.' . $phpEx);
  // Start session management
  $user->session_begin();
  $auth->acl($user->data);
  $user->setup();
  // end stuff to tie into forums

?>

Този код го слагаш на всеки .php файл където ползваш "входовете" тъй казано където трябва да имаш достъп до страница чрез регистрация / вход.. Не се изказах много точно , защото не мога да си обоснова точно отговора.
 
Много ясно, това е заради requiere_once - слага ти само веднъж конфига, при повторно изискване на конфиг това го блокира (затова е once = веднъж)...
 
php_mysql каза:
Код:
<?php
  require_once($include_directory . 'forum/config.php');
  function display($string) {
    return htmlspecialchars(stripslashes($string), ENT_QUOTES);
  }

  //stuff to tie into phpbb forums
  define('IN_PHPBB', true);
  $phpbb_root_path = $home_directory . 'forum/';
  $phpEx = substr(strrchr(__FILE__, '.'), 1);
  include($phpbb_root_path . 'common.' . $phpEx);
  // Start session management
  $user->session_begin();
  $auth->acl($user->data);
  $user->setup();
  // end stuff to tie into forums

?>

Този код го слагаш на всеки .php файл където ползваш "входовете" тъй казано където трябва да имаш достъп до страница чрез регистрация / вход.. Не се изказах много точно , защото не мога да си обоснова точно отговора.

Да този код е слаган във всичките страници


DeathGuard_ каза:
Много ясно, това е заради requiere_once - слага ти само веднъж конфига, при повторно изискване на конфиг това го блокира (затова е once = веднъж)...

То няма ли това само веднъж другаде невиждам същото.
 

Back
Горе