本文整理汇总了PHP中Application_Model_User::insertUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_User::insertUser方法的具体用法?PHP Application_Model_User::insertUser怎么用?PHP Application_Model_User::insertUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application_Model_User
的用法示例。
在下文中一共展示了Application_Model_User::insertUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subscribeAction
public function subscribeAction()
{
if ($this->getRequest()->isPost()) {
$email = $this->getRequest()->getPost('email', null);
$password = $this->getRequest()->getPost('pwd', null);
$confpassword = $this->getRequest()->getPost('confpwd', null);
$firstname = $this->getRequest()->getPost('firstname', null);
$lastname = $this->getRequest()->getPost('lastname', null);
$modelUser = new Application_Model_User();
$user = $modelUser->getByEmail($email);
$modelValidation = new Application_Model_ValidationCode();
if (!empty($email) && !empty($password) && !empty($firstname) && !empty($lastname)) {
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
if ($password == $confpassword) {
if (!isset($user->id_user)) {
$userId = $modelUser->insertUser(array('email' => $email, 'password' => sha1($password), 'first_name' => $firstname, 'last_name' => $lastname, 'date_created' => date('Y-m-d H:i:s')));
$code = md5(uniqid(rand(), true));
$modelValidation->insert(array("code" => $code, "user_id" => $userId, "is_confirmed" => 0, "type" => 0));
mail($email, "Confirmation de votre compte", "Veuillez cliquer sur le lien ci-dessous pour confirmer votre compte : \n" . "<a href='http://localhost/inm5151/INM5151/public/index/confirmation/code/" + $code + "'>Lien de confirmation</a>");
$this->view->success = true;
} else {
$this->view->error = "Un utilisateur avec ce courriel existe déjà.";
}
} else {
$this->view->error = "Les deux mots de passes doivent être identiques.";
}
} else {
$this->view->error = "Veuillez entrer un courriel valide.";
}
} else {
$this->view->error = "Tous les champs doivent être remplis.";
}
if (!empty($this->view->error)) {
$this->view->firstname = $firstname;
$this->view->lastname = $lastname;
}
}
}