public function insert()
 {
     $user_model = new UsersModel();
     $account_model = new AccountsModel();
     //检查验证码是否一致
     if ($_SESSION['verify'] != strtolower($_POST['verify'])) {
         flash('验证码不一致');
         $_SESSION['last_form'] = $_POST;
         redirect($_SERVER['HTTP_REFERER']);
         return;
     }
     if (empty($_POST['work_field']) && empty($_POST['expertise'])) {
         flash('关注领域不能为空');
         $_SESSION['last_form'] = $_POST;
         redirect($_SERVER['HTTP_REFERER']);
         return;
     }
     if (!check_model()) {
         flash('您提交的内容中可能有不合适的地方,请重新编辑');
         $_SESSION['last_form'] = $_POST;
         $this->redirect('register');
     }
     if (empty($_POST['type'])) {
         $_POST['type'] = 'ngo';
     }
     $_POST['create_time'] = date('Y-m-d H:i:s');
     if (!$_SESSION['login_user']['is_admin']) {
         $_POST['is_admin'] = 0;
     }
     if ($_POST['type'] == "ind") {
         $_POST['is_checked'] = 1;
     }
     $user_model->create();
     $account_id = $account_model->add_user($_POST);
     if ($account_id) {
         $user_model->account_id = $account_id;
         $user_model->password = '******';
         // hide password - the real hashed password is stored in account model
         $user_model->add();
         $account_model->login($_POST['email'], $_POST['password']);
         $this->redirect('home');
     } else {
         $this->redirect('register');
         //写好User/home后定位到该目标
     }
 }