Alert message in SESSION

0

I have a system that works perfectly on the computer (A) that was developed and, when passing the computer (B) server with the same settings, the same version of EasyPHP and etc, presented many but many errors.

One of these errors is immediately in the login and says:

  

"Notice: A session was already started - ignoring session_start ()   in (directory / logica-user.php) on line 4. "

This is the logica-usuario.php:

<?php
session_start();
function verificausuario(){
    if (!isset($_SESSION["usuario_logado"])) {
    header("location: login.php");
    die();
   }
}
function verificausuario() {
    if(!isset($_SESSION["usuario_logado"])) {
    header("location: login2.php");
    die();
   }
}
function logaUsuario($nome) {
    $_SESSION["usuario_logado"] = $nome;
}
function logout() {
    session_destroy();
}

?>

Line 4 is this session_start (); but there is nothing wrong with it, after all, it's all bugged system is the same system that runs perfectly on computer (A) and runs on computer (B) before it is formatted.

    
asked by anonymous 16.11.2017 / 12:04

1 answer

0

It worked when I did this:

<?php
if(!isset($_SESSION)) {
    session_start();
}
function verificausuario(){
    if (!isset($_SESSION["usuario_logado"])) {
    header("location: login.php");
    die();
   }
}
function verificausuario() {
    if(!isset($_SESSION["usuario_logado"])) {
    header("location: login2.php");
    die();
   }
}
function logaUsuario($nome) {
    $_SESSION["usuario_logado"] = $nome;
}
function logout() {
    session_destroy();
}

?>
    
16.11.2017 / 12:22