Esempio n. 1
0
 function pageaddaccount($inPath)
 {
     if ($_POST) {
         $adminObj = new m_admin();
         $post = base_Utils::shtmlspecialchars($_POST);
         $item = array();
         $item["admin_name"] = $post['admin_name'];
         $item["admin_pwd"] = md5($post['pwd']);
         $item["gid"] = (int) $post['group'];
         foreach ($item as $k => $v) {
             if (!$v) {
                 $this->ShowMsg("字段:{$k}不能够为空");
             }
         }
         if ($adminObj->insert($item)) {
             $this->ShowMsg('添加成功', $this->createUrl('/account/index'), '', '1');
         }
         $this->ShowMsg('添加出错!原因:' . $adminObj->getError());
     }
     $groupObj = new m_group();
     $this->params['group'] = $groupObj->select()->items;
     return $this->render('account/addaccount.html', $this->params);
 }