Ejemplo n.º 1
0
 public function adduserAction()
 {
     //添加管理员
     if ($this->request->isPost()) {
         $this->view->disable();
         if (stristr($_SERVER['CONTENT_TYPE'], 'application/x-www-form-urlencoded')) {
             $post = $_POST;
         } elseif (stristr($_SERVER['CONTENT_TYPE'], 'application/json')) {
             $post = json_decode(file_get_contents("php://input"), true);
         }
         $admin = new Admin();
         $admin->setPasswd(md5(trim($post['passwd'])));
         $admin->setAddTime();
         $admin->setName(htmlspecialchars(trim($post['name'])));
         $admin->setDepart(intval(trim($post['depart'])));
         $admin->create();
         exit;
     }
 }