public function startAction() { //$this->view->setRenderLevel(View::LEVEL_NO_RENDER); if ($this->request->isPost()) { $email = mb_strtolower($this->request->getPost('email')); $password = $this->request->getPost('pass'); $user = Chefdetails::findFirst(array("(c_email = :email:)", 'bind' => array('email' => $email))); if ($user != false) { $user2 = Chefdetails::findFirst(array("(c_email = :email: AND c_pass = :password:)", 'bind' => array('email' => $email, 'password' => sha1("{$password}" . "{$user->c_salt}")))); if ($user2 != false) { $this->_registerSession($user2); // session variable return $this->response->redirect('admin'); } } $this->flash->error('<span class="glyphicon glyphicon-info-sign"></span> Wrong Email - Password Combination'); } return $this->response->redirect('cheflogin'); }
public function updateAction() { $auth = $this->session->get('auth'); $uid = $auth[cid]; $user = Chefdetails::findFirst(array("(c_id = :id:)", 'bind' => array('id' => $uid))); if ($this->request->isPost()) { $email = mb_strtolower($this->request->getPost('email')); $fname = $this->request->getPost('fname'); $lname = $this->request->getPost('lname'); $phno = $this->request->getPost('phno'); if ($user->c_email == $email) { $user->c_fname = $fname; $user->c_lname = $lname; $user->c_phno = $phno; $user->save(); $this->flash->success('<span class="glyphicon glyphicon-info-sign"></span> Details Successfully Updated'); } else { $this->flash->error('<span class="glyphicon glyphicon-info-sign"></span> Wrong email address'); } $this->response->redirect('adminprofile'); } }