mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 01:54:49 +00:00
add basic auth to auth.inc
This commit is contained in:
parent
cd06a9b98f
commit
f9b24c4aa2
@ -1451,4 +1451,23 @@ function session_auth() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* do a basic authentication, uses $_SERVER['HTTP_AUTHORIZATION'] to validate user.
|
||||
* @param $http_auth_header http_authorization header content
|
||||
* @return bool
|
||||
*/
|
||||
function http_basic_auth($http_auth_header)
|
||||
{
|
||||
$tags=explode(" ", $http_auth_header) ;
|
||||
if (count($tags) >= 2) {
|
||||
$userinfo= explode(":", base64_decode($tags[1])) ;
|
||||
if (count($userinfo)>=2) {
|
||||
return authenticate_user($userinfo[0], $userinfo[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// not authenticated
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user