Database/Database.php
public function connect() {
		
		if (file_exists(dirname( __FILE__ )."/drivers/".$this->driver.".php")) {
			$this->db = include_once("drivers/".$this->driver.".php");
			$failover = (count($this->failOver) > 0)? TRUE:FALSE;

			$con = FALSE;
			if (!isset($_SESSION['failover']) || empty($_SESSION['failover'])) {
				if (in_array($this->driver, ['sqlite', 'sqlite3']))
					$con = @$this->db->connect($this->dbname, $failover);
				elseif (in_array($this->driver, $this->dsnuse))
					$con = @$this->db->connect($this->dsn, $this->dbname, $this->hostname, $this->username, $this->password, $failover);
				else
					$con = @$this->db->connect($this->dbname, $this->hostname, $this->username, $this->password, $failover, $this->charset);
			}

			if (!$con && count($this->failOver) > 0) {
				$fo = $this->failOver;
				if (isset($_SESSION['failover']) && !empty($_SESSION['failover'])) {
					$fo_id = base64_decode($_SESSION['failover']);
					if (in_array($fo[$fo_id]['driver'], ['sqlite', 'sqlite3']))
						$con = @$this->db->connect($fo[$fo_id]['dbname'], $failover);
					elseif (in_array($fo[$fo_id]['driver'], $this->dsnuse))
						$con = @$this->db->connect($fo[$fo_id]['dsn'], $fo[$fo_id]['dbname'], $fo[$fo_id]['hostname'], $fo[$fo_id]['username'], $fo[$fo_id]['password'], $failover);
					else
						$con = @$this->db->connect($fo[$fo_id]['dbname'], $fo[$fo_id]['hostname'], $fo[$fo_id]['username'], $fo[$fo_id]['password'], $failover);
				} else {
					while(list($id, $fo_config) = each($fo)) {
						if (in_array($fo_config['driver'], ['sqlite', 'sqlite3']))
							$con = @$this->db->connect($fo_config['dbname'], $failover);
						elseif (in_array($fo_config['driver'], $this->dsnuse))
							$con = @$this->db->connect($fo_config['dsn'], $fo_config['dbname'], $fo_config['hostname'], $fo_config['username'], $fo_config['password'], $failover);
						else
							$con = @$this->db->connect($fo_config['dbname'], $fo_config['hostname'], $fo_config['username'], $fo_config['password'], $failover);

						if ($con) {
							$_SESSION['failover'] = base64_encode($id);
							break;
						}
					}

				}

				if (!$con) {
					header('X-Error-Message: Fail Connecting', true, 500);
					die('All Connecting Database Error');
					$this->db = NULL;
				}
				return $this->db;
			} else {
				if (isset($_SESSION['failover']))
					unset($_SESSION['failover']);
			}

			return $this->db;
			
		} else
			throw new \Exception('Database Library: Unknown Driver');
		
		
	}
public function connect() {
		
		if (file_exists(dirname( __FILE__ )."/drivers/".$this->driver.".php")) {
			$this->db = include_once("drivers/".$this->driver.".php");
			$failover = (count($this->failOver) > 0)? TRUE:FALSE;

			$con = FALSE;
			if (!isset($_SESSION['failover']) || empty($_SESSION['failover'])) {
				if (in_array($this->driver, ['sqlite', 'sqlite3']))
					$con = @$this->db->connect($this->dbname, $failover);
				elseif (in_array($this->driver, $this->dsnuse))
					$con = @$this->db->connect($this->dsn, $this->dbname, $this->hostname, $this->username, $this->password, $failover);
				else
					$con = @$this->db->connect($this->dbname, $this->hostname, $this->username, $this->password, $failover, $this->charset);
			}

			if (!$con && count($this->failOver) > 0) {
				$fo = $this->failOver;
				if (isset($_SESSION['failover']) && !empty($_SESSION['failover'])) {
					$fo_id = base64_decode($_SESSION['failover']);
					if (in_array($fo[$fo_id]['driver'], ['sqlite', 'sqlite3']))
						$con = @$this->db->connect($fo[$fo_id]['dbname'], $failover);
					elseif (in_array($fo[$fo_id]['driver'], $this->dsnuse))
						$con = @$this->db->connect($fo[$fo_id]['dsn'], $fo[$fo_id]['dbname'], $fo[$fo_id]['hostname'], $fo[$fo_id]['username'], $fo[$fo_id]['password'], $failover);
					else
						$con = @$this->db->connect($fo[$fo_id]['dbname'], $fo[$fo_id]['hostname'], $fo[$fo_id]['username'], $fo[$fo_id]['password'], $failover);
				} else {
					while(list($id, $fo_config) = each($fo)) {
						if (in_array($fo_config['driver'], ['sqlite', 'sqlite3']))
							$con = @$this->db->connect($fo_config['dbname'], $failover);
						elseif (in_array($fo_config['driver'], $this->dsnuse))
							$con = @$this->db->connect($fo_config['dsn'], $fo_config['dbname'], $fo_config['hostname'], $fo_config['username'], $fo_config['password'], $failover);
						else
							$con = @$this->db->connect($fo_config['dbname'], $fo_config['hostname'], $fo_config['username'], $fo_config['password'], $failover);

						if ($con) {
							$_SESSION['failover'] = base64_encode($id);
							break;
						}
					}

				}

				if (!$con) {
					header('X-Error-Message: Fail Connecting', true, 500);
					die('All Connecting Database Error');
					$this->db = NULL;
				}
				return $this->db;
			} else {
				if (isset($_SESSION['failover']))
					unset($_SESSION['failover']);
			}

			return $this->db;
			
		} else
			throw new \Exception('Database Library: Unknown Driver');
		
		
	}
connect
@return res id