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
<?php
/* funkcja dodatku Smarty wywoływana w chwili wykonania instrukcji
load_customer_login szablonu */
function smarty_function_load_customer_login($params, $smarty)
{
$customer_login = new CustomerLogin();
$customer_login->init();
// zdefiniowanie zmiennej assign szablonu
$smarty->assign($params['assign'], $customer_login);
}
class CustomerLogin
{
//publiczne składowe
public $mLabelLoginMessage;
public $mActionTarget;
public $mRegisterUser;
//prywatne składowe
private $email;
private $password;
private $mHaveData = 0;
private $mBoCustomer;
//konstruktor klasy
function __construct()
{
$this->mBoCustomer = new BoCustomer();
//sprawdź, czy zostały przekazane dane
if (isset($_POST['Login'])) $this->mHaveData = 1;
}
public function init()
{
$this->mActionTarget = "https://" . $_SERVER['SERVER_NAME'] .
$_SERVER['REQUEST_URI'];
$this->mRegisterUser = $_SERVER['REQUEST_URI'] .
(empty($_GET) ?
"?" : "&") . "RegisterCustomer"; $this->mRegisterUser = $_SERVER['REQUEST_URI'].(empty($_GET) ?
"?" : "&"). "RegisterCustomer";
if ($this->mHaveData)
{
//sprawdź stan logowania
$login_status = $this->mBoCustomer->IsValidUser($_POST['txtEmail'],
$_POST['txtPassword']);
switch ($login_status)
{
case 2:
$this->mLabelLoginMessage = "Nieprawidłowy adres e-mail.";
break;
case 1:
$this->mLabelLoginMessage = "Nieprawidłowe hasło.";
break;
case 0:
//dane prawidłowe...przekierowanie
header("Location:".$this->mActionTarget); }
}
}
} //koniec klasy
?>