How did that not ever cause any issues?

This commit is contained in:
Klaus-Uwe Mitterer 2017-10-09 09:21:54 +02:00
parent e944c119fd
commit cc3cb6e99c
1 changed files with 6 additions and 4 deletions

View File

@ -15,14 +15,14 @@ $realm = 'GPS Tracker';
if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Digest realm="'.$realm.
'",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
die('Authentication failed.');
}
if (!($data = http_digest_parse($_SERVER['PHP_AUTH_DIGEST']))) {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Digest realm="'.$realm. '",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
header('WWW-Authenticate: Digest realm="'.$realm.
'",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"'); '",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
die ('Authentication failed.');
}
@ -32,7 +32,8 @@ $result = $conn->query($sql);
if ($result->num_rows != 1) {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Digest realm="'.$realm. '",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
header('WWW-Authenticate: Digest realm="'.$realm.
'",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"'); '",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
die('Authentication failed.');
}
@ -43,7 +44,8 @@ $valid_response = md5($A1.':'.$data['nonce'].':'.$data['nc'].':'.$data['cnonce']
if ($data['response'] != $valid_response) {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Digest realm="'.$realm. '",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
header('WWW-Authenticate: Digest realm="'.$realm.
'",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"'); '",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
die('Authentication failed.');
}