How did that not ever cause any issues?
This commit is contained in:
parent
e944c119fd
commit
cc3cb6e99c
10
auth.php
10
auth.php
|
@ -15,14 +15,14 @@ $realm = 'GPS Tracker';
|
||||||
if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
|
if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
|
||||||
header('HTTP/1.1 401 Unauthorized');
|
header('HTTP/1.1 401 Unauthorized');
|
||||||
header('WWW-Authenticate: Digest realm="'.$realm.
|
header('WWW-Authenticate: Digest realm="'.$realm.
|
||||||
'",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
|
|
||||||
|
|
||||||
die('Authentication failed.');
|
die('Authentication failed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!($data = http_digest_parse($_SERVER['PHP_AUTH_DIGEST']))) {
|
if (!($data = http_digest_parse($_SERVER['PHP_AUTH_DIGEST']))) {
|
||||||
header('HTTP/1.1 401 Unauthorized');
|
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.');
|
die ('Authentication failed.');
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,8 @@ $result = $conn->query($sql);
|
||||||
|
|
||||||
if ($result->num_rows != 1) {
|
if ($result->num_rows != 1) {
|
||||||
header('HTTP/1.1 401 Unauthorized');
|
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.');
|
die('Authentication failed.');
|
||||||
}
|
}
|
||||||
|
@ -43,7 +44,8 @@ $valid_response = md5($A1.':'.$data['nonce'].':'.$data['nc'].':'.$data['cnonce']
|
||||||
|
|
||||||
if ($data['response'] != $valid_response) {
|
if ($data['response'] != $valid_response) {
|
||||||
header('HTTP/1.1 401 Unauthorized');
|
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.');
|
die('Authentication failed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue