Sindbad~EG File Manager
<?php
/**
* Database Configuration for COP News Portal
*/
class Database {
private $host = 'ded6071.inmotionhosting.com';
private $db_name = 'copmadinaarea_cop_news_portal';
private $username = 'copmadinaarea_nabibo';
private $password = 'copmadinaarea_nabibo';
private $charset = 'utf8mb4';
private $conn;
public function getConnection() {
$this->conn = null;
try {
$dsn = "mysql:host=" . $this->host . ";dbname=" . $this->db_name . ";charset=" . $this->charset;
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
$this->conn = new PDO($dsn, $this->username, $this->password, $options);
} catch(PDOException $exception) {
error_log("Connection error: " . $exception->getMessage());
throw new Exception("Database connection failed");
}
return $this->conn;
}
public function testConnection() {
try {
$conn = $this->getConnection();
return $conn !== null;
} catch(Exception $e) {
return false;
}
}
}
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists