diff --git a/keyControlPanel.php b/keyControlPanel.php index e3ea60d..4289e9a 100755 --- a/keyControlPanel.php +++ b/keyControlPanel.php @@ -35,8 +35,9 @@ // if the user refreshes the page, it will default to the // access code screen session_start(); - $formState = STATE_ACCESS_SUCCESSFULL; + $formState = STATE_ACTION_NEWCODE; $keyCode = ""; + $keyData = ReadKeyFile(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 @@ -52,7 +53,7 @@ { // if a key code has been entered, get the state of that key $keyCode = $_POST["keyCode"]; - $keyData = ReadKeyFile(KEYFILE); + //$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"])); @@ -74,7 +75,7 @@ } // if the access code was correct and no code was entered else - $formState = STATE_ACCESS_SUCCESSFULL; + $formState = STATE_ACTION_NEWCODE; } // generate a new submission id that is used within the form to prevent double posts $_SESSION["submissionId"] = rand(); @@ -106,14 +107,14 @@ case STATE_ACTION_ACTIVATED: case STATE_ACTION_USED: case STATE_ACTION_NEWCODE: - CreateKeyCodeBox("", true); + CreateKeyDropDownBox($keyData, ""); break; // if previously entered key was not found or the action that should // be performed has been failed, just display the key code box with // previously entered value case STATE_KEY_NONEXISTENT: case STATE_ACTION_FAILED: - CreateKeyCodeBox($keyCode, true); + CreateKeyDropDownBox($keyData, $keyCode); break; // if an existing key has been entered, display the readonly key code box // and all options that can be performed on the key @@ -190,6 +191,31 @@ echo " \n"; echo "\n"; } + /** + * Echos a drop down box with all keys. + * + * @param string $keyCode The key that should be displayed in the box. + */ + function CreateKeyDropDownBox($keyData, $keyCode) + { + CreateRowHeader(); + echo "
ESE Code:
\n"; + echo "