Hi!
Here's my code for autehntication:
if ($PHP_AUTH_USER != "username" || $PHP_AUTH_PW != "password" || $logoff==1) {
header("Status: HTTP/1.0 401 Unauthorized");
if (!($logoff==1)) {
header("WWW-Authenticate: Basic realm=\"reporting (".strftime("%r",time()).")\"");
echo "You must log in for reports.\n";
} else {
echo "You are now logged off the reporting system.\n";
echo "For complete security, please close all your browser windows.\n";
unset($PHP_AUTH_USER); unset($PHP_AUTH_PW);
}
exit;
}
echo "Welcome, you're in.\nPHP_AUTH_USER = $PHP_AUTH_USER\n$PHP_AUTH_PW = $PHP_AUTH_PW\n";
echo "<hr><a href=\"$PHP_SELF?logoff=1\">Log off</a>";
Here's what I get when I perform second login:
Warning: Cannot add header information - headers already sent by (output started at /home/.../proba2.php:5) in /home/.../proba2.php on line 84
Warning: Cannot add header information - headers already sent by (output started at /home/.../proba2.php:5) in /home/.../proba2.php on line 86
Anybody knows the solution?
Bye!