Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] integracja logowania strony z forum phpBB3 - ROZWIĄZANE, a dokładniej przekierowanie;)
KCG
post
Post #1





Grupa: Zarejestrowani
Postów: 449
Pomógł: 4
Dołączył: 1.12.2006

Ostrzeżenie: (0%)
-----


Praktycznie połączyłem już logowanie z forum, z tym, że jak zaloguję się formularzem na stronie, to jestem przekierowany na forum. Jakoś nie mogę znaleźć fragmentu odpowiadającego za to przekierowanie. Adres przekazuje zmienna $_GET['url'], w przypadku wylogawnia zrobiłem tak:
  1. <?php
  2. case 'logout':
  3. if ($user->data['user_id'] != ANONYMOUS && isset($_GET['sid']) && !is_array($_GET['sid']) && $_GET['sid'] === $user->session_id)
  4. {
  5. $user->session_kill();
  6. $user->session_begin();
  7. if ($_GET['url']) { // to dodałem
  8. header('Location: '.urldecode($_GET['url']));
  9. exit; 
  10. } // koniec mego kodu;)
  11. $message = $user->lang['LOGOUT_REDIRECT'];
  12. }
  13. else
  14. {
  15. $message = ($user->data['user_id'] == ANONYMOUS) ? $user->lang['LOGOUT_REDIRECT'] : $user->lang['LOGOUT_FAILED'];
  16. }
  17. meta_refresh(3, append_sid(&#092;"{$phpbb_root_path}index.$phpEx\"));
  18.  
  19. $message = $message . '
  20.  
  21. ' . sprintf($user->lang['RETURN_INDEX'], '<a href=\"' . append_sid(&#092;"{$phpbb_root_path}index.$phpex\") . '\">', ' ');
  22. trigger_error($message);
  23.  
  24. break;
  25. ?>

A logowanie pośrednio jest tu:
  1. <?php
  2. case 'login':
  3. if ($user->data['is_registered'])
  4. {
  5. redirect(append_sid(&#092;"{$phpbb_root_path}index.$phpEx\"));
  6. }
  7. login_box(request_var('redirect', &#092;"index.$phpEx\"));
  8. break;
  9. ?>

Może ktoś to robił i wie, gdzie szukać? (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Z góry dzięki.

No doszedłem, bo sprawa dosyć prosta, jest pole hidden 'redirect', tylko, że przez to pole przekierowuje http://strona/forum/dopiero mój adres, jest możliwość przejść wyżej do katalogu? ./ i ../ nie działa (IMG:http://forum.php.pl/style_emoticons/default/sad.gif)

Sam doszedłem (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif) w polu trzeba podać pełny adres strony z http:// i działa. Z tym, że najpierw strona z info forum 'zostałeś zalogowany', ale po kilku sekundach lub kliknięciu w link następuje przekierowanie (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Ew. jakby ktoś wiedział, jak zrobić, aby bezpośrednio przekierował (jakby używając header('Location: ...')) byłbym wdzięczny (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg) </a href=\"' . append_sid(\"{$phpbb_root_path}index.$phpex\") . '\"></br ></br >

Ten post edytował KCG 2.01.2008, 17:03:01
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Draz
post
Post #2





Grupa: Zarejestrowani
Postów: 7
Pomógł: 1
Dołączył: 11.02.2009

Ostrzeżenie: (0%)
-----


Dzisiaj nad tym siedzialem i wymyslilem takie rozwiazanie:

W pliku includes/functions.php jest funkcja login_box()

  1. <?php
  2. // The result parameter is always an array, holding the relevant information...
  3.            if ($result['status'] == LOGIN_SUCCESS)
  4.            {
  5.                $redirect = request_var('redirect', "{$phpbb_root_path}index.$phpEx");
  6.                $message = ($l_success) ? $l_success : $user->lang['LOGIN_REDIRECT'];
  7.                $l_redirect = ($admin) ? $user->lang['PROCEED_TO_ACP'] : (($redirect === "{$phpbb_root_path}index.$phpEx" || $redirect === "index.$phpEx") ? $user->lang['RETURN_INDEX'] : $user->lang['RETURN_PAGE']);
  8.    
  9.                // append/replace SID (may change during the session for AOL users)
  10.                $redirect = reapply_sid($redirect);
  11.    
  12.                // Special case... the user is effectively banned, but we allow founders to login
  13.                if (defined('IN_CHECK_BAN') && $result['user_row']['user_type'] != USER_FOUNDER)
  14.                {
  15.                    return;
  16.                }
  17.                $redirect = $_SERVER['HTTP_REFERER']; // te dwa wiersze wstawilem
  18.                      header('Location: '.$redirect.'');
  19.                //meta_refresh(0, $redirect); ---->zmiana
  20.                trigger_error($message . '
  21.    
  22.    ' . sprintf($l_redirect, '<a href="' . $redirect . '">', '</a>'));
  23.            }
  24. ?>


Pozdrawiam
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 7.10.2025 - 18:01