prepared_query(" INSERT INTO users_main (Username, Email, PassHash, torrent_pass, Enabled, PermissionID) VALUES (?, ?, ?, ?, '1', ?)", $username, $email, Users::make_password_hash($password), $torrentPass, USER); //Increment site user count $Cache->increment('stats_user_count'); //Grab the userID $userId = $DB->inserted_id(); Tracker::update_tracker('add_user', ['id' => $userId, 'passkey' => $torrentPass]); //Default stylesheet $DB->query(" SELECT ID FROM stylesheets"); list($StyleID) = $DB->next_record(); //Auth key $authKey = randomString(); //Give them a row in users_info $DB->prepared_query(" INSERT INTO users_info (UserID, StyleID, AuthKey) VALUES (?, ?, ?) ", $userId, $StyleID, $authKey ); // Give the notification settings $DB->prepared_query("INSERT INTO users_notifications_settings (UserID) VALUES (?)", $userId); $DB->prepared_query(" INSERT INTO users_leech_stats (UserID, Uploaded) VALUES (?, ?)", $userId, STARTING_UPLOAD); $DB->prepared_query(' INSERT INTO user_bonus (user_id) VALUES (?) ', $UserID ); $DB->prepared_query(' INSERT INTO user_flt (user_id) VALUES (?) ', $userId ); //Redirect to users profile header ("Location: user.php?id=$userId"); //What to do if we don't have a username, email, or password } elseif (empty($username)) { //Give the Error -- We do not have a username error('Please supply a username'); } elseif (empty($email)) { //Give the Error -- We do not have an email address error('Please supply an email address'); } elseif (empty($password)) { //Give the Error -- We do not have a password error('Please supply a password'); } else { //Uh oh, something went wrong error('Unknown error'); } //Form wasn't sent -- Show form } else { ?>