public function registrationAction() { $this->view->title = "Реєстрація нового користувача"; $this->view->headTitle($this->view->title, 'PREPEND'); $form = new Form_Registration(); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { //добавляємо користувача //save і fill створені методи в створеному класі Model_User $user = new Model_User(); $user->fill($form->getValues()); //getValues() - повертає асоціативний масив полів форми $user->created = date('Y-m-d, H:i:s'); $user->password = sha1($user->password); //sha1 — хэш строки $user->code = uniqid(); //генерація унікального ID $user->save(); $user->sendActivationEmail(); //надсилаємо активаційний email $this->_helper->redirector('index'); } } $this->view->form = $form; }
public function registrationAction() { $this->view->title = "Регистрация нового пользователя."; $this->view->headTitle($this->view->title, 'PREPEND'); $form = new Form_Registration(); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { $user = new Model_User(); $user->fill($form->getValues()); $user->created = date('Y-m-d H:i:s'); $user->password = sha1($user->password); $user->code = uniqid(); $user->save(); $user->sendActivationEmail(); $this->_helper->redirector('index'); } } $this->view->form = $form; }