Hello all,
I have this method like so:
public function verificaLogin($nivelAcesso, $pURL = false)
{
//se nao houver variável de sessão setada ou se o nível de utilizador for menor que o nível de acesso:
if (!isset($_SESSION['idUtilizador']) OR ($_SESSION['nivelUtilizador'] < $nivelAcesso))
{
// Destrói a sessão
session_destroy();
// e redirecciona para url
if ($pURL)
{
Funcao::redirecciona($pURL);
}
$this->_msgErro = 'A página pretendida é de acesso restrito. A sessão expirou. Faça login novamente. Obrigado';
}
}
Later on this class I have this method:
/**
*
* @return string
* @desc mostra mensagem de erro setada num dos métodos da classe.
*/
public function mostraMsgErro()
{
return $this->_msgErro;
}
I would then have something like this on my login page:
<?php echo (isset($resultado['insucessoLogin'])) ? '<div id="login-erro"><span>'.$resultado['insucessoLogin'].'</span></div>':''; ?>
The intended result is to display that specific method error message, on the page that the user has been redirected to.
But I’m lost now.
Somewhere I will need to have this:
$resultado['insucessoLogin'] = mostraMsgErro();
But I’m not quite sure were to put it… :s
Can I have a push here… :sick:
Thanks in advance,
Márcio