$realname = trim($realname); $email_usr = trim($email_usr); if (empty($username) || empty($password) || empty($cpassword) || empty($email_usr)) { // Do we have all necessary data? $be->box_full($t->translate("Error"), $t->translate("Please enter") . " <b>" . $t->translate("Username") . "</b>, <b>" . $t->translate("Password") . "</b> " . $t->translate("and") . " <b>" . $t->translate("E-Mail") . "</b>!"); break; } if (strcmp($password, $cpassword)) { // password are identical? $be->box_full($t->translate("Error"), $t->translate("The passwords are not identical") . ". " . $t->translate("Please try again") . "!"); break; } /* Does the user already exist? NOTE: This should be a transaction, but it isn't... */ $db->query("select * from auth_user where username='******'"); if ($db->nf() > 0) { $be->box_full($t->translate("Error"), $t->translate("User") . " <B>{$username}</B> " . $t->translate("already exists") . "!<br>" . $t->translate("Please select a different Username") . "."); break; } // Create a uid and insert the user... $u_id = md5(uniqid($hash_secret)); $modification_usr = "******"; $creation_usr = "******"; $permlist = "user_pending"; $query = "insert into auth_user values('{$u_id}','{$username}','{$password}','{$realname}','{$email_usr}',{$modification_usr},{$creation_usr},'{$permlist}')"; $db->query($query); if ($db->affected_rows() == 0) { $be->box_full($t->translate("Error"), $t->translate("Registration of new User failed") . ":<br> {$query}"); break; } // send mail