}
if ($uuid == '') {
// Error getting UUID, display an error asking user to update manually
$uuid_error = true;
}
// Hash password
$password = password_hash(Input::get('password'), PASSWORD_BCRYPT, array("cost" => 13));
// Get current unix time
$date = new DateTime();
$date = $date->getTimestamp();
try {
// Create groups
// Only create if they don't already exist for some reason
$group_exists = $queries->getWhere("groups", array("id", "=", 1));
if (!count($group_exists)) {
$queries->create("groups", array('id' => 1, 'name' => 'Standard', 'group_html' => '<span class="label label-success">Member</span>', 'group_html_lg' => '<span class="label label-success">Member</span>'));
}
$group_exists = $queries->getWhere("groups", array("id", "=", 2));
if (!count($group_exists)) {
$queries->create("groups", array('id' => 2, 'name' => 'Admin', 'group_html' => '<span class="label label-danger">Admin</span>', 'group_html_lg' => '<span class="label label-danger">Admin</span>', 'mod_cp' => 1, 'admin_cp' => 1, 'staff' => 1));
}
$group_exists = $queries->getWhere("groups", array("id", "=", 3));
if (!count($group_exists)) {
$queries->create("groups", array('id' => 3, 'name' => 'Moderator', 'group_html' => '<span class="label label-info">Moderator</span>', 'group_html_lg' => '<span class="label label-info">Moderator</span>', 'mod_cp' => 1, 'staff' => 1));
}
// Create admin account
$user->create(array('username' => Input::get('username'), 'password' => $password, 'pass_method' => 'default', 'mcname' => $mcname, 'uuid' => $uuid, 'joined' => $date, 'group_id' => 2, 'email' => Input::get('email'), 'lastip' => "", 'active' => 1));
$login = $user->login(Input::get('username'), Input::get('password'), true);
if ($login) {
if (!isset($uuid_error)) {
echo '<script>window.location.replace("./install.php?step=convert");</script>';