コード例 #1
0
ファイル: 1.3.php プロジェクト: Pwelling/vogelenzang
 /**
  * \brief maakt de verbinding met de database
  * 
  * @author P.Welling
  * 
  * @since 1.0
  */
 function connect_db()
 {
     $this->db = set_db();
     $this->pw = set_pw();
     $this->user = set_user();
     $this->conn = mysql_pconnect('localhost', $this->user, $this->pw) or trigger_error(mysql_error(), E_USER_ERROR);
 }
コード例 #2
0
 public function db_connect()
 {
     if ($this->is_installed) {
         // To avoid multiple database connection
         if (!$this->db_connected()) {
             include_once SYSTEM_DIR . 'config/db_config.php';
             $this->db = DB($db, TRUE);
             set_db($this->db);
             $this->db_connected = true;
             if (!defined('DB_ROOT')) {
                 define('DB_ROOT', $config['dbprefix']);
             }
             return true;
         }
     } else {
         if (!$this->db_connected() && array_key_exists('db_datas', $_SESSION)) {
             $config = $_SESSION['db_datas'];
             $this->db = DB($config, TRUE);
             set_db($this->db);
             $this->db_connected = true;
             if (!defined('DB_ROOT')) {
                 define('DB_ROOT', $config['dbprefix']);
             }
             return true;
         }
     }
     return false;
 }