public function addadminAction() { $form = new LoginForm(); $request = $this->getRequest(); if ($request->isPost()) { $admin = new Model\Admin(); $form->setInputFilter($admin->getInputFilter()); $form->setData($request->getPost()); if ($form->isValid()) { $admin->exchangeArray($form->getData()); $this->getAdminTable()->saveAdmin($admin); var_dump($_SESSION); exit; return $this->redirect()->toRoute('admin'); } else { throw new \Exception('Твоя гавноформа не проходит валидацию. Иди еби мозги'); } } return new ViewModel(['form' => $form]); }
public function createaccountAction() { $viewModel = new ViewModel(); $this->layout('layout/bags'); $form = new LoginForm(); $response = $this->getResponse(); $request = $this->getRequest(); if ($request->isPost()) { $admin = new Admin(); $form->setData($request->getPost()); if ($form->isValid()) { $admin->exchangeArray($form->getData()); $k = $this->getAdminTable()->checklogin($admin); if ($k == 1 || $k == 2) { echo 'Incorrect Username or password'; } if ($k == 0) { } } } return $viewModel; }