second(), 3 => third(), 4 => fourth(), 5 => fifth(), default => first(), }; /** * First page - show warnings and gather info */ function first() { echo << Dragon Knight Installation Dragon Knight Installation: Page One

Installation for Dragon Knight is a simple two-step process: set up the database tables, then create the admin user. After that, you're done.

HTML; } /** * Set up database tables. */ function second() { echo "Dragon Knight InstallationDragon Knight Installation: Page Two

"; $query = db()->exec(<<' : 'Error creating Babble Box table.'; $query = db()->exec(<<' : 'Error creating Control table.'; $query = db()->exec("INSERT INTO control VALUES (1, 'Dragon Knight', 250, 1, '', '', 'Mage', 'Warrior', 'Paladin', 1, 1, 1, 1);"); echo $query === true ? 'Control table populated.
' : 'Error populating Control table.'; $query = db()->exec(<<' : 'Error creating Drops table.'; $query = db()->exec(<<' : 'Error populating Drops table.'; $query = db()->exec(<<' : 'Error creating Forum table.'; $query = db()->exec(<<' : 'Error creating Items table.'; $query = db()->exec(<<' : 'Error populating Items table.'; $query = db()->exec(<<' : 'Error creating Levels table.'; $query = db()->exec(<<' : 'Error populating Levels table.'; $query = db()->exec(<<' : 'Error creating Monsters table.'; $query = db()->exec(<<' : 'Error populating Monsters table.'; $query = db()->exec(<<' : 'Error creating News table.'; $query = db()->exec("INSERT INTO news (content) VALUES ('This is the first news post. Please use the admin control panel to add another one and make this one go away.');"); echo $query === true ? 'News table populated.
' : 'Error populating News table.'; $query = db()->exec(<<' : 'Error creating Spells table.'; $query = db()->exec(<<' : 'Error populating Spells table.'; $query = db()->exec(<<' : 'Error creating Towns table.'; $query = db()->exec(<<' : 'Error populating Towns table.'; $query = db()->exec(<<' : 'Error creating Users table.'; $time = round((microtime(true) - START), 4); echo "
Database setup complete in $time seconds.

Click here to continue with installation."; } /** * Gather user info for admin account. */ function third() { echo << Dragon Knight Installation Dragon 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.

Username:


Password:
Verify Password:


Email Address:
Verify Email:


Character Class:
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 Installation Dragon 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 Installation Dragon 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; }