query(" INSERT INTO users_main (Username, Email, PassHash, torrent_pass, Enabled, PermissionID) VALUES ('".db_string($Username)."', '".Crypto::encrypt($Email)."', '".db_string(Users::make_sec_hash($Password))."', '".db_string($torrent_pass)."', '1', '".USER."')"); // Increment site user count $Cache->increment('stats_user_count'); // Grab the UserID $UserID = $DB->inserted_id(); Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $torrent_pass)); // Default stylesheet $DB->query(" SELECT ID FROM stylesheets"); list($StyleID) = $DB->next_record(); // Auth key $AuthKey = Users::make_secret(); // Give them a row in users_info $DB->query(" INSERT INTO users_info (UserID, StyleID, AuthKey, JoinDate) VALUES ('".db_string($UserID)."', '".db_string($StyleID)."', '".db_string($AuthKey)."', NOW())"); // Give the notification settings $DB->query("INSERT INTO users_notifications_settings (UserID) 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 { ?>

Create a User

Username
Email Address
Password