Example #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);
 }
Example #2
0
 function pageaddrights($inPath)
 {
     if (!$_POST['group_name']) {
         return $this->render('system/addrights.html', $this->params);
     } else {
         $item = array();
         $item['group_name'] = base_Utils::shtmlspecialchars($_POST['group_name']);
         if ($item['group_name']) {
             $groupObj = new m_group();
             $res = $groupObj->selectOne("group_name='{$item['group_name']}'", 'gid');
             if ($res) {
                 $this->ShowMsg('用户组名称已经存在!');
             }
             $item['action_code'] = $this->creatRights($_POST);
             $rs = $groupObj->insert($item);
             if ($rs) {
                 $this->ShowMsg('添加成功', $this->createUrl('/system/rights'), '', 1);
             } else {
                 $this->ShowMsg('添加失败,请重试!错误原因:' . $groupObj->getError());
             }
         }
         $this->ShowMsg('用户组名称不能够为空!');
     }
 }