Click here to continue with installation.";
}
/**
* Gather user info for admin account.
*/
function third()
{
echo <<
Dragon Knight InstallationDragon Knight Installation: Page Three
Now you must create an administrator account so you can use the control panel. Fill out the form below to create your account. You will be able to customize the class names through the control panel once your admin account is created.
HTML;
}
/**
* Final page: insert new user row, congratulate the person on a job well done.
*/
function fourth()
{
$form = validate($_POST, [
'username' => ['length:3-18', 'alpha-spaces'],
'email' => ['email'],
'confirm_email' => ['confirm'],
'password' => ['length:6-255'],
'confirm_password' => ['confirm']
]);
if (!$form['valid']) exit(ul_from_validate_errors($form['errors']));
$form = $form['data'];
if (db()->query(
"INSERT INTO users (username, password, email, verify, charclass, authlevel) VALUES (?, ?, ?, 1, ?, 1)",
[$form['username'], password_hash($form['password'], PASSWORD_ARGON2ID), $form['email'], $form['charclass']]
) === false) {
exit("Failed to create user.");
}
file_put_contents('../.installed', date('Y-m-d H:i:s'));
echo <<
Dragon Knight InstallationDragon Knight Installation: Page Four
Your admin account was created successfully. Installation is complete.
Be sure to delete install.php from your Dragon Knight directory for security purposes.
You are now ready to play the game. Note that you must log in through the public section before being allowed into the control panel. Once logged in, an "Admin" link will appear in the Functions box of the left sidebar panel.
Thank you for using Dragon Knight!
-----
Optional: Dragon Knight is a free product, and does not require registration of any sort. However, there is an
optional "call home" function in the installer, which notifies the author of your game installation. The ONLY information
transmitted with this function is the URL to your game. This is included mainly to satisfy the author's curiosity about
how many copies of the game are being installed and used. If you choose to submit your URL to the author, please
click here.
HTML;
}
/**
* Call Home function.
*/
function fifth()
{
if (mail("sky@sharkk.net", "Dragon Knight Call Home", $_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"]) !== true) {
exit('Dragon Knight was unable to send your URL. Please go back and try again, or just continue on to the game.');
}
echo <<
Dragon Knight InstallationDragon Knight Installation: Page Five
Thank you for submitting your URL!
You are now ready to play the game. Note that you must log in through the public section before being allowed into the control panel. Once logged in, an "Admin" link will appear in the Functions box of the left sidebar panel.
HTML;
}