Problem with header

Asked

Viewed 46 times

1

I had this code running on my PC’s localhost but when I put it on the server it no longer runs. When I call the function verificaLoginAdmin() he always returns:

Warning: Cannot Modify header information - headers already sent by (output Started at /home/xxxxx/public_html/admin.php:1) in /home/xxxxxx/public_html/cmd/funcoes.php on line 42

I had this same problem on the localhost of my PC but to solve it was simple, I put the function ob_start(); in the beginning gives page functions and the ob_clean() in the end, and it was already solved, but now on the server is not giving the same result.

function redireciona($url=''){  
    header("Location: ".BASEURL.$url);
}

function verificaLoginAdmin(){
     $sessao = new sessao();
     if($sessao->getNvars()<=0 || $sessao->getVar('nivel_ur')!='admin' || $sessao->getVar('ip_ur')!=$_SERVER['REMOTE_ADDR']){
         redireciona('index.php');
     }
}
  • 1

    See if this http://answall.com/questions/4251/erro-do-php-cannot-modify-header-information can help you

  • 1

    guy really worth it! I had a space before opening PHP, thank you very much.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.