improved documentation and code of authenticate.php, inlining log_unknown