Removed debug databases
This commit is contained in:
parent
f8c99519d8
commit
cc11e1be6a
1 changed files with 4 additions and 21 deletions
|
@ -5,25 +5,11 @@ class Dao
|
||||||
|
|
||||||
private $conn;
|
private $conn;
|
||||||
|
|
||||||
private $debug = false;
|
|
||||||
|
|
||||||
private function get_debug_mode () {
|
|
||||||
$this->debug = file_exists(__DIR__.DIRECTORY_SEPARATOR."../DEBUG");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->get_debug_mode();
|
|
||||||
if ($this->debug) {
|
|
||||||
$username = 'phpmyadmin';
|
|
||||||
$password = $this->read_password();;
|
|
||||||
$dsn = 'mysql:dbname=phpmyadmin;host=127.0.0.1';
|
|
||||||
} else {
|
|
||||||
$username = 'accueil_insa';
|
$username = 'accueil_insa';
|
||||||
$password = $this->read_password();
|
$password = $this->read_password();
|
||||||
$dsn = 'mysql:dbname=accueil_insa;host=127.0.0.1';
|
$dsn = 'mysql:dbname=accueil_insa;host=127.0.0.1';
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
$this->conn = new PDO($dsn, $username, $password, [PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8']);
|
$this->conn = new PDO($dsn, $username, $password, [PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8']);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
|
@ -33,9 +19,6 @@ class Dao
|
||||||
|
|
||||||
private function read_password()
|
private function read_password()
|
||||||
{
|
{
|
||||||
if ($this->debug)
|
|
||||||
$real_path = __DIR__.DIRECTORY_SEPARATOR.".htpassdb_debug";
|
|
||||||
else
|
|
||||||
$real_path = __DIR__.DIRECTORY_SEPARATOR.".htpassdb";
|
$real_path = __DIR__.DIRECTORY_SEPARATOR.".htpassdb";
|
||||||
$file = fopen($real_path, "r") or die("Unable to open DB password file!");;
|
$file = fopen($real_path, "r") or die("Unable to open DB password file!");;
|
||||||
$password = fgets($file);
|
$password = fgets($file);
|
||||||
|
|
Loading…
Reference in a new issue