diff --git a/keyControlPanel.php b/keyControlPanel.php index 67b61a3..b30b3bf 100755 --- a/keyControlPanel.php +++ b/keyControlPanel.php @@ -37,7 +37,7 @@ session_start(); $formState = STATE_ACTION_NEWCODE; $keyCode = ""; - $keyData = ReadKeyFile(KEYFILE); + $keyData = ReadKeys(KEYFILE); // if the variable is set, the form has been posted to itself // if the submission ids of the post and the form don't match, the @@ -55,8 +55,9 @@ $keyCode = $_POST["keyCode"]; //$keyData = ReadKeyFile(KEYFILE); // if no action was performed on the entered key, simply display its state - if (!isset($_POST["action"])) - $formState = KeyStateToFormState(GetKeyState($keyData, $_POST["keyCode"])); + if (!isset($_POST["action"])){ + $formState = KeyStateToFormState(GetKeyState(KEYFILE, $_POST["keyCode"])); + } else { // otherwise set the state of the form to the action that should be performed @@ -65,8 +66,8 @@ // on the key and if the action was successful save the key file if ($formState != STATE_ACTION_NEWCODE) { - if (SetKeyState($keyData, $keyCode, FormStateToKeyState($formState))) - WriteKeyFile(KEYFILE, $keyData); + if (SetKeyState(KEYFILE, $keyCode, FormStateToKeyState($formState))) + SetKeyState(KEYFILE, $keyCode, FormStateToKeyState($formState)); else $formState($STATE_ACTION_FAILED); $_POST["action"] = STATE_ACTION_NEWCODE; @@ -205,11 +206,11 @@ echo "