示例#1
0
 public function initialization()
 {
     @session_start();
     //相關工具設定
     //基礎的資安防護
     $VTs = new clsTools();
     if (!empty($_POST)) {
         $_POST = $VTs->replacePackage($_POST);
     }
     if (!empty($_GET)) {
         $_GET = $VTs->replacePackage($_GET);
     }
     //結束基礎的資安防護
     //取得資料庫設定值
     $strIniFile = __DIR__ . '\\..\\connDB.ini';
     $sSection = 'connDB';
     $sServer = $VTs->GetINIInfo($strIniFile, $sSection, 'servername', '');
     $sUser = $VTs->GetINIInfo($strIniFile, $sSection, 'user', '');
     $sPassWord = $VTs->GetINIInfo($strIniFile, $sSection, 'password', '');
     $sDatabase = $VTs->GetINIInfo($strIniFile, $sSection, 'defaultDB', '');
     //放到共同變數中
     $iniSet["DBSet"]["sServer"] = $sServer;
     $iniSet["DBSet"]["sUser"] = $sUser;
     $iniSet["DBSet"]["sPassWord"] = $sPassWord;
     $iniSet["DBSet"]["sDatabase"] = $sDatabase;
     //存到變數,以重複利用
     $this->SystemToolsService = $VTs;
     //釋放
     $VTs = null;
     //相關工具設定結束
     //建立資料庫連線
     $VTc = new clsDB_MySQL();
     $VTc->CreateDBConnection($sServer, $sDatabase, $sUser, $sPassWord);
     //存到變數,以重複利用
     $this->SystemDBService = $VTc;
     //釋放
     $VTs = null;
     //結束
 }
 public function initialization($DBSection = '')
 {
     @session_start();
     //相關工具設定
     //基礎的資安防護
     $VTs = new clsTools();
     if (!empty($_POST)) {
         $_POST = $VTs->replacePackage($_POST);
     }
     if (!empty($_GET)) {
         $_GET = $VTs->replacePackage($_GET);
     }
     //結束基礎的資安防護
     //取得資料庫設定值
     $strIniFile = dirname(__DIR__) . '\\..\\..\\config\\connDB.ini';
     if (!file_exists($strIniFile)) {
         $strIniFile = dirname(__DIR__) . '/../../config/connDB.ini';
     }
     $sSection = 'connDB';
     if (!$DBSection) {
         $DBSection = 'defaultDB';
     }
     $sServer = $VTs->GetINIInfo($strIniFile, $sSection, 'servername', '');
     $sUser = $VTs->GetINIInfo($strIniFile, $sSection, 'user', '');
     $sPassWord = $VTs->GetINIInfo($strIniFile, $sSection, 'password', '');
     //取得資料庫
     $sDatabase = $VTs->GetINIInfo($strIniFile, $DBSection, 'defaultDB', '');
     //放到共同變數中
     $iniSet["DBSet"]["sServer"] = $sServer;
     $iniSet["DBSet"]["sUser"] = $sUser;
     $iniSet["DBSet"]["sPassWord"] = $sPassWord;
     $iniSet["DBSet"]["sDatabase"] = $sDatabase;
     //載入LOG設定檔
     $strIniFile = __DIR__ . '\\..\\setlog.ini';
     if (!file_exists($strIniFile)) {
         $strIniFile = __DIR__ . '/../setlog.ini';
     }
     $sSection = "log";
     $this->logFileSetting = $VTs->GetINIInfo($strIniFile, $sSection, 'write', '');
     //存到變數,以重複利用
     $this->SystemToolsService = $VTs;
     //釋放
     $VTs = null;
     //相關工具設定結束
     //建立資料庫連線
     $VTc = new clsDB_MySQL();
     $VTc->CreateDBConnection($sServer, $sDatabase, $sUser, $sPassWord);
     //存到變數,以重複利用
     $this->SystemDBService = $VTc;
     //釋放
     $VTs = null;
 }