Every respondent who takes the MPADQ must enter a valid license key before they can begin the questionnaire. Keys are 10-character alphanumeric codes that are generated in bulk by the admin and distributed to book purchasers. Each key is single-use: once a respondent completes the quiz, the key is marked inactive and the results become permanently viewable. This page covers how to generate keys, where they are stored, and how to download them for distribution.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ijmeisner/einerlei/llms.txt
Use this file to discover all available pages before exploring further.
Navigating to Key Generation
From the dashboard home at/admin/dashboard/, click Generate Keys. This takes you to /admin/dashboard/keygen/.
Generating Keys
Open the Generate Keys page
Navigate to
/admin/dashboard/keygen/. You will see a number input field
labelled Number of Keys to generate and a Generate button.Enter a quantity
Type a number between 1 and 1000 into the input field. This is the
number of unique license keys that will be created in this batch.
Keys are generated and stored
keyGenerator.php runs a loop $count times. For each iteration it calls
keygen() to produce a plain-text key, hashes it with MD5, checks the
License table for a collision, and inserts the hashed key with
active = 1. The plain-text key is accumulated for display.Key Generation Algorithm
Keys are produced by thekeygen() function defined in keyGenerator.php:
- Length: 10 characters.
- Character set: lowercase letters
a–z(26), digits0–9(10), uppercase lettersA–Z(26) — 62 characters total. - Randomness: each character position is chosen independently with
mt_rand(0, 61). - Uniqueness check: after generation, the MD5 hash of the key is checked against the
Licensetable. If a collision is found the loop regenerates until a unique hash is obtained. - Storage: only the MD5 hash of the key is written to the database. The plain-text key is shown to the admin once and stored in the session for download; it is never persisted in plain text.
License Table Schema
Keys are stored in theLicense table of the Quiz database:
| Column | Type | Description |
|---|---|---|
id | INT, AUTO_INCREMENT, PRIMARY KEY | Unique row identifier assigned by MySQL. |
licenseKey | VARCHAR(255) | MD5 hash of the plain-text license key. |
active | TINYINT(1) / BOOL | 1 = key is unused and valid; 0 = key has been used and the quiz is complete. |
Key Lifecycle
A key begins its life as active (active = 1) the moment it is inserted. When a respondent successfully completes the questionnaire and submits their answers, the application sets active = 0 for that key. From that point on:
- The key cannot be used to start a new quiz session.
- The respondent can return to view their results using the same key.
Viewing and Downloading a Key Batch
After generation you land on/admin/dashboard/keygen/keys/. This page:
- Displays the plain-text keys in a read-only
<textarea>— one key per line. - Provides a DOWNLOAD button that submits a GET request to
downloadKeys.php.
downloadKeys.php performs the following:
- Retrieves the key list from
$_SESSION['keyFile']. - Builds a filename in the format
keys_MM-DD-YYYY.csvusing today’s date. - Writes the keys to
keygen/keys/keyArchive/keys_MM-DD-YYYY.csvon the server. - Sends the file to the browser as an
application/octet-streamdownload attachment.
The download is triggered from session data that is set during the current
generation run. If you navigate away from the keys page before downloading,
the session data may be lost. Always download immediately after generating, or
retrieve the archived CSV from the
keyArchive/ directory on the server.