Exemplo n.º 1
0
 private function Init()
 {
     error_reporting(E_ALL);
     self::$__arGlobalConfigArray = [];
     if (self::$__arGlobalConfigArray) {
         return true;
     }
     try {
         self::$__arGlobalConfigArray = parse_ini_file("site.ini", 1);
     } catch (Exception $e) {
         print "error in parsing the file {$e->getMessage}();";
         return false;
     }
     //print_r($this->__arGlobalConfigArray);
     return true;
 }
Exemplo n.º 2
0
 private function dbConnect()
 {
     $objSiteConfig = new CSiteGlobalConfig();
     $this->hostname = $objSiteConfig->getDBHost();
     $this->schema = $objSiteConfig->getDBSchema();
     $this->username = $objSiteConfig->getDBUserName();
     $this->password = $objSiteConfig->getDBPassword();
     echo "The db name is" . $this->schema;
     $this->db = new PDO("mysql:host={$this->hostname};dbname={$this->schema}", $this->username, $this->password);
     $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     echo "Connect to the database" . $objSiteConfig->getDBSchema();
 }