Error: ignoring session_start() and undefined index

i make a function to check if someone are login or not. but there’s an error. first error is A session had already been started-ignoring session_start() and undefined index: email and pass. please help

code:

    function cek_login(){
        session_start();
        $hasil = 0;

    $mail = $_SESSION['email'];
    $pass = $_SESSION['pass'];

    if (!empty($mail) and !empty($pass)){
        $hasil = 1;
    }

    return $hasil;
  }

Please do not post the same issue multiple times. Thanks!

Continue the Discussion at