Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Closed TopicStart new topic
> header - problem z przekierowaniem
jessica99
post
Post #1





Grupa: Zarejestrowani
Postów: 36
Pomógł: 0
Dołączył: 14.12.2006
Skąd: Warszawa/Mrozy

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


pojawił mi się następujący błąd: Cannot modify header information - headers already sent by
problem w linii54 wydaje mi sie ze powinnam zmienic te funkcje na if zamiast kolejnego header'a

  1. <?php
  2. /* funkcja dodatku Smarty wywoływana w chwili wykonania instrukcji
  3. load_customer_login szablonu */
  4. function smarty_function_load_customer_login($params, $smarty)
  5. {
  6. $customer_login = new CustomerLogin();
  7. $customer_login->init();
  8. // zdefiniowanie zmiennej assign szablonu
  9. $smarty->assign($params['assign'], $customer_login);
  10. }
  11.  
  12. class CustomerLogin
  13. {
  14. //publiczne składowe
  15. public $mLabelLoginMessage;
  16. public $mActionTarget;
  17. public $mRegisterUser;
  18. //prywatne składowe
  19. private $email;
  20. private $password;
  21. private $mHaveData = 0;
  22. private $mBoCustomer;
  23. //konstruktor klasy
  24. function __construct()
  25. {
  26. $this->mBoCustomer = new BoCustomer();
  27. //sprawdź, czy zostały przekazane dane
  28. if (isset($_POST['Login']))
  29. $this->mHaveData = 1;
  30. }
  31. public function init()
  32. {
  33. $this->mActionTarget = "https://" . $_SERVER['SERVER_NAME'] .
  34.  $_SERVER['REQUEST_URI'];
  35. $this->mRegisterUser = $_SERVER['REQUEST_URI'] . 
  36.  (empty($_GET) ? "?" : "&") . "RegisterCustomer";
  37. $this->mRegisterUser = $_SERVER['REQUEST_URI'].(empty($_GET) ? "?" : "&").
  38. "RegisterCustomer";
  39. if ($this->mHaveData)
  40. {
  41. //sprawdź stan logowania
  42. $login_status = $this->mBoCustomer->IsValidUser($_POST['txtEmail'],
  43. $_POST['txtPassword']);
  44. switch ($login_status)
  45. {
  46. case 2:
  47. $this->mLabelLoginMessage = "Nieprawidłowy adres e-mail.";
  48. break;
  49. case 1:
  50. $this->mLabelLoginMessage = "Nieprawidłowe hasło.";
  51. break;
  52. case 0:
  53. //dane prawidłowe...przekierowanie
  54. header("Location:".$this->mActionTarget);
  55. }
  56.  
  57. }
  58.  
  59. }
  60. } //koniec klasy
  61. ?>
Go to the top of the page
+Quote Post
tiraeth
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 1 789
Pomógł: 41
Dołączył: 30.10.2003
Skąd: Wrocław

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


Ta? Mówisz poważnie? Że nagłówków już nie możesz wysłać? A to peszek....

Poszukaj na forum pod hasłami headers already sent (szczególnie na Przedszkolu). Zamykam.
Go to the top of the page
+Quote Post

Closed TopicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.12.2025 - 10:14