delayed user creation

This commit is contained in:
Shish
2009-01-22 01:39:44 -08:00
parent cffbaac039
commit b336b5296f
4 changed files with 35 additions and 43 deletions

View File

@@ -233,9 +233,13 @@ class UserPage implements Extension {
$hash = md5(strtolower($event->username) . $event->password);
$email = (!empty($event->email)) ? $event->email : null;
// if there are currently no admins, the new user should be one
$need_admin = ($database->db->GetOne("SELECT COUNT(*) FROM users WHERE admin IN ('Y', 't', '1')") == 0);
$admin = $need_admin ? 'Y' : 'N';
$database->Execute(
"INSERT INTO users (name, pass, joindate, email) VALUES (?, ?, now(), ?)",
array($event->username, $hash, $email));
"INSERT INTO users (name, pass, joindate, email, admin) VALUES (?, ?, now(), ?, ?)",
array($event->username, $hash, $email, $admin));
}
private function set_login_cookie($name, $pass) {