paperboy_api/authentication_header.fnc.php
// function to parse the http auth header
function to parse the http auth header
function to parse the http auth header
function http_digest_parse($txt)
{
    $needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1);
    $data = array();
    $keys = implode('|', array_keys($needed_parts));
    preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER);
    foreach ($matches as $m) {
        $data[$m[1]] = $m[3] ? $m[3] : $m[4];
        unset($needed_parts[$m[1]]);
    }
    return $needed_parts ? false : $data;
}
function http_digest_parse ( $ txt ) { $ needed_parts = array ( 'nonce' => 1 , 'nc' => 1 , 'cnonce' => 1 , 'qop' => 1 , 'username' => 1 , 'uri' => 1 , 'response' => 1 ) ; $ data = array ( ) ; $ keys = implode ( '|' , array_keys ( $ needed_parts ) ) ; preg_match_all ( '@(' . $ keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@' , $ txt , $ matches , PREG_SET_ORDER ) ; foreach ( $ matches as $ m ) { $ data [ $ m [ 1 ] ] = $ m [ 3 ] ? $ m [ 3 ] : $ m [ 4 ] ; unset ( $ needed_parts [ $ m [ 1 ] ] ) ; } return $ needed_parts ? false : $ data ; }
function to parse the http auth header
function to parse the http auth header
// protect against missing data