I have a simple login check like this:
function send_error($message) {
header ( 'Content-Type: text/html; charset=utf-8' );
header ( 'HTTP/1.0 406 Not acceptable' );
echo $message;
exit ();
}
session_start ();
if (! isset ( $_SESSION ["login"] ) || $_SESSION ["login"] === "" || ! isset ( $_SESSION ["type"] )) {
send_error ( 'ERRORE: Devi prima aver eseguito il login per poter fare logout.' );
}
The problem is that warnings show up for lines of code that come after this part if the user has not done login.
Why?
Shouldn't exit();
command stop code execution? This is one of the warnings:
Warning: Cannot modify header information - headers already sent by (output started at /var/www/people/ltw1313/cgi-bin/verifica_login.php:11) in /var/www/people/ltw1313/cgi-bin/verifica_post.php on line 13