Change wrong DSN name for db wrapper and update config class
This commit changes how the config class gets it's values to a more solid way. Additonally, the DSN was updated to use a correct format, allowing PDO to connect (With a wrong DSN, it tries to connect to something that doesn't exist).
This commit is contained in:
@@ -12,46 +12,23 @@ class Application
|
||||
|
||||
|
||||
|
||||
$this->database['username'] = $cConfigArray['core']['database']['username'];
|
||||
$this->database['password'] = $cConfigArray['core']['database']['password'];
|
||||
$this->database['hostname'] = $cConfigArray['core']['database']['hostname'];
|
||||
$this->database['dbname'] = $cConfigArray['core']['database']['dbname'];
|
||||
|
||||
$this->instDB();
|
||||
}
|
||||
|
||||
private function isHostAlive($domain)
|
||||
{
|
||||
$starttime = microtime(true);
|
||||
$file = fsockopen ($domain, 80, $errno, $errstr, 10);
|
||||
$stoptime = microtime(true);
|
||||
$status = 0;
|
||||
$this->database['username'] = $cConfigArray['database']['username'];
|
||||
$this->database['password'] = $cConfigArray['database']['password'];
|
||||
$this->database['hostname'] = $cConfigArray['database']['hostname'];
|
||||
$this->database['dbname'] = $cConfigArray['database']['dbname'];
|
||||
|
||||
if (!$file) $status = -1; // Site is down
|
||||
else
|
||||
{
|
||||
fclose($file);
|
||||
$status = ($stoptime - $starttime) * 1000;
|
||||
$status = floor($status);
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
protected function instDB()
|
||||
{
|
||||
|
||||
$dsn = "mysql:host=" . $this->database['hostname'] . "dbname=" . $this->database['dbname'];
|
||||
|
||||
$dsn = 'mysql:dbname=' . $this->database['dbname'] . ';host=' . $this->database['hostname'];
|
||||
$username = $this->database['username'];
|
||||
$password = $this->database['password'];
|
||||
|
||||
echo $this->database['hostname'];
|
||||
|
||||
$Conn = \ParagonIE\EasyDB\Factory::create($dsn, $username, $password);
|
||||
$this->db = \ParagonIE\EasyDB\Factory::create($dsn, $username, $password);
|
||||
|
||||
$this->db = $Conn;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function Exists($Table, $IDRowColumnName, $SearchValue)
|
||||
{
|
||||
$exists = $db->cell(
|
||||
|
Reference in New Issue
Block a user