本文整理汇总了PHP中UserMapper::insertNewUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserMapper::insertNewUser方法的具体用法?PHP UserMapper::insertNewUser怎么用?PHP UserMapper::insertNewUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserMapper
的用法示例。
在下文中一共展示了UserMapper::insertNewUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerAction
public function registerAction()
{
Request::ajax();
$message = ErMessenger::getInstance();
$request = new Request();
$request->initRequest();
$post = $request->getPost();
if (isset($post)) {
if (!empty($post['email']) && !empty($post['password']) && !empty($post['pass_confirm']) && !empty($post['captcha'])) {
$userMapper = new UserMapper();
$user = $userMapper->getUserByEmail($post["email"]);
if (!$user) {
if (Captcha::verify()) {
$givenEmail = $this->clearStr($post['email']);
$givenPassword = $this->clearStr($post["password"]);
if (filter_var($givenEmail, FILTER_VALIDATE_EMAIL)) {
$user = new User();
$userMapper = new UserMapper();
$user->email = $givenEmail;
$user->crdate = date("Y-m-d");
$user->access = 'ps';
$user->userstatus = 1;
$user->userpassword = hash("md5", $givenPassword);
if ($userMapper->insertNewUser($user)) {
$message->setSucceedMessage('201', 'index/index');
ErSession::saveToSession('user', $user->email);
if ($user->username != null) {
ErSession::saveToSession('username', $user->username);
}
} else {
$message->setErrMessage('101', 'user/signup');
}
} else {
$message->setErrMessage('103', 'user/signup');
}
} else {
$message->setErrMessage('104', 'user/signup');
}
} else {
$message->setErrMessage('102', 'user/signup');
}
}
}
}