Exemplo n.º 1
0
 function adduserAction()
 {
     $system = new Admin_Model_User();
     if ($this->_request->isPost()) {
         $pass1 = $this->_request->getParam('password');
         $pass2 = $this->_request->getParam('re_password');
         $user = $this->_request->getParam('username');
         $exit = $system->list_user_2($user);
         if ($exit == 2) {
             if (strlen($pass1) < 9) {
                 thongbao("Password phải từ 8 ký tự trở lên");
                 return false;
             } else {
             }
             if ($pass1 == $pass2 && $user != '') {
                 $this->view->purifier = Zend_Registry::get('purifier');
                 $conf = HTMLPurifier_Config::createDefault();
                 $purifier = new HTMLPurifier($conf);
                 $username = $purifier->purify($this->_request->getParam('username'));
                 $password = $purifier->purify(sha1(salt . $this->_request->getParam('password')));
                 $email = $purifier->purify($this->_request->getParam('email'));
                 $full_name = $purifier->purify($this->_request->getParam('full_name'));
                 $status = $purifier->purify($this->_request->getParam('status'));
                 $group_name = $purifier->purify($this->_request->getParam('group_name'));
                 $system->insert_user($username, $password, $email, $full_name, $status, $group_name);
             } else {
                 thongbao("Bạn đã nhập liệu sai");
             }
         } else {
             thongbao("User này đã tồn tại");
         }
     }
 }