Example #1
0
 }
 /* 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
 $message = $t->translate("Thank you for registering on the {$sys_name} Site. In order") . "\n" . $t->translate("to complete your registration, visit the following URL") . ": \n\n" . "https:" . $sys_url . "verify.php?confirm_hash={$u_id}\n\n" . $t->translate("Enjoy the site") . ".\n\n" . $t->translate(" -- the {$sys_name} crew") . "\n";
 mail($email_usr, "[{$sys_name}] " . $t->translate("User Registration"), $message, "From: {$ml_newsfromaddr}\nReply-To: {$ml_newsreplyaddr}\nX-Mailer: PHP");
 $msg = $t->translate("Congratulations") . "! " . $t->translate("You have registered on {$sys_name}") . "." . "<p>" . $t->translate("Your new username is") . ": <b>{$username}</b>" . "<p>" . $t->translate("You are now being sent a confirmation email to verify your email address") . "." . "<br>" . $t->translate("Visiting the link sent to you in this email will activate your account") . ".";
 if ($ml_notify) {
     $message = "Username: {$username}\n";
     $message .= "Realname: {$realname}\n";
     $message .= "E-Mail:   {$email_usr}\n";
     mailuser("admin", "New User has registered", $message);
 }
 $bx->box_full($t->translate("User Registration"), $msg);
 $reg = 1;