diff --git a/bin/init_rcc.php b/bin/init_rcc.php index 1f7481c..54f236f 100644 --- a/bin/init_rcc.php +++ b/bin/init_rcc.php @@ -16,22 +16,21 @@ if ($username == "") { } echo 'Password: '; -$password = exec('read -s PW; echo $PW'); +$password = readline("Password: "); if ($password == "") { echo "No password given. Aborting...\n"; exit(); } -$hash = password_hash($password, PASSWORD_BCRYPT); - $username = '$username = "' . $username . '";'; -$hash = '$hash = "' . $hash . '";'; +$password = '$password = "' . $password . '";'; -$file = ' password -$users = array('admin' => 'mypass', 'guest' => 'guest'); +$users = array($username => $password); if (empty($_SERVER['PHP_AUTH_DIGEST'])) { header('HTTP/1.1 401 Unauthorized'); @@ -24,6 +25,7 @@ if (empty($_SERVER['PHP_AUTH_DIGEST'])) { // analyze the PHP_AUTH_DIGEST variable if (!($data = DigestAuth::httpDigestParse($_SERVER['PHP_AUTH_DIGEST'])) || !isset($users[$data['username']])) { + var_dump($_SERVER["PHP_AUTH_DIGEST"]); die('Wrong Credentials!'); } @@ -34,5 +36,6 @@ $A2 = md5($_SERVER['REQUEST_METHOD'].':'.$data['uri']); $valid_response = md5($A1.':'.$data['nonce'].':'.$data['nc'].':'.$data['cnonce'].':'.$data['qop'].':'.$A2); if ($data['response'] != $valid_response) { + var_dump($_SERVER["PHP_AUTH_PW"]); die('Wrong Credentials!'); } diff --git a/rcc/password.php b/rcc/password.php index 973ada0..d267c54 100644 --- a/rcc/password.php +++ b/rcc/password.php @@ -1,3 +1,3 @@