Ejemplo n.º 1
0
 public function Add()
 {
     if ($this->_GET['SeverID']) {
         $FuwuqiModel = new FuwuqiModule();
         $Data = $FuwuqiModel->GetOneInfoByKeyID($this->_GET['SeverID']);
         $this->Data = $Data;
     } elseif ($this->_POST['SeverID']) {
         $Data['FuwuqiName'] = trim($this->_POST['FuwuqiName']);
         $Data['IP'] = trim($this->_POST['IP']);
         $Data['CName'] = trim($this->_POST['CName']);
         $Data['FwAdress'] = trim($this->_POST['FwAdress']);
         $Data['FTP'] = trim($this->_POST['FTP']);
         $Data['FTPName'] = trim($this->_POST['FTPName']);
         $Data['FTPPassword'] = trim($this->_POST['FTPPassword']);
         $Data['FTPDuankou'] = trim($this->_POST['FTPDuankou']);
         $Data['FTPMulu'] = trim($this->_POST['FTPMulu']);
         if ($this->_POST['State']) {
             $Data['State'] = 1;
         } else {
             $Data['State'] = 0;
         }
         if ($Data['FuwuqiName'] == '') {
             $this->__Message('服务器名称不能为空!');
         }
         $FuwuqiModel = new FuwuqiModule();
         if ($FuwuqiModel->UpdateArrayByKeyID($Data, $this->_POST['SeverID'])) {
             $this->__Message('修改服务器成功!', UrlRewriteSimple('Fuwuqi', 'Manage', true), '继续操作');
         } else {
             $this->__Message('修改服务器失败,请再一次尝试!');
         }
     } else {
         if ($this->_POST) {
             $Data['FuwuqiName'] = trim($this->_POST['FuwuqiName']);
             $Data['IP'] = trim($this->_POST['IP']);
             $Data['CName'] = trim($this->_POST['CName']);
             $Data['FwAdress'] = trim($this->_POST['FwAdress']);
             $Data['FTP'] = trim($this->_POST['FTP']);
             $Data['FTPName'] = trim($this->_POST['FTPName']);
             $Data['FTPPassword'] = trim($this->_POST['FTPPassword']);
             $Data['FTPDuankou'] = trim($this->_POST['FTPDuankou']);
             $Data['FTPMulu'] = trim($this->_POST['FTPMulu']);
             if ($this->_POST['State']) {
                 $Data['State'] = 1;
             } else {
                 $Data['State'] = 0;
             }
             if ($Data['FuwuqiName'] == '') {
                 $this->__Message('服务器名称不能为空!');
             }
             $FuwuqiModel = new FuwuqiModule();
             if ($FuwuqiModel->InsertArray($Data)) {
                 $this->__Message('添加服务器成功!', UrlRewriteSimple('Fuwuqi', 'Manage', true), '继续操作');
             } else {
                 $this->__Message('添加服务器失败,请再一次尝试!');
             }
         }
     }
 }