Ejemplo n.º 1
0
        $bot->notice($user, "That e-mail address is already associated " . "with a registered nickname.");
        return false;
    }
    if ($account = $this->getAccount($user_name)) {
        $bot->noticef($user, "The nickname %s%s%s has already been registered. Please choose another.", BOLD_START, $user_name, BOLD_END);
        return false;
    }
    if ($this->isBadnick($user_name)) {
        $bot->noticef($user, 'You are not allowed to register that nickname.');
        return false;
    }
    $password_md5 = md5($password);
    $account = new DB_User();
    $account->setName($user->getNick());
    $account->setRegisterTs(time());
    $account->setPassword($password_md5);
    $account->setEmail($email);
    $account->setAutoOp(true);
    $account->setAutoVoice(true);
    $account->updateLastseen();
    $account->save();
    $this->addAccount($account);
    if (!$user->hasAccountName()) {
        $this->sendf(FMT_ACCOUNT, SERVER_NUM, $numeric, $user_name, $account->getRegisterTs());
        $user->setAccountName($user_name);
        $user->setAccountId($account->getId());
    }
    $bot->noticef($user, "Your account, %s%s%s, has been registered. You are now logged in.", BOLD_START, $user_name, BOLD_END);
} else {
    $bot->notice($user, "You have already registered your nick and logged in.");
}
Ejemplo n.º 2
0
 /**
  * Add a new user
  */
 function add_user($fields = array())
 {
     try {
         $user = new DB_User();
         $user->set_all($fields);
         $user->save();
         return $user;
     } catch (Exception $e) {
         return false;
     }
 }