092a8bc7ce
- Removed all backup/duplicate files - Removed test files from root - Consolidated documentation to /docs/ - Moved scripts to /scripts/ - Renamed f_* directories (removed prefix) - Organized icons and assets - Removed unused vendor directories - Cleaned up redundant config files
39 lines
1017 B
PHP
39 lines
1017 B
PHP
<?php
|
|
// EasyStream Database Class
|
|
if (!defined("_ISVALID")) { exit; }
|
|
|
|
class DB {
|
|
private $pdo;
|
|
|
|
public function __construct() {
|
|
try {
|
|
$this->pdo = new PDO(
|
|
"mysql:host=db;dbname=easystream;charset=utf8mb4",
|
|
"easystream",
|
|
"easystream",
|
|
[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]
|
|
);
|
|
} catch (PDOException $e) {
|
|
die("Database connection failed: " . $e->getMessage());
|
|
}
|
|
}
|
|
|
|
public function Execute($query, $params = []) {
|
|
$stmt = $this->pdo->prepare($query);
|
|
$stmt->execute($params);
|
|
return $stmt;
|
|
}
|
|
|
|
public function GetRow($query, $params = []) {
|
|
$stmt = $this->Execute($query, $params);
|
|
return $stmt->fetch(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
public function GetAll($query, $params = []) {
|
|
$stmt = $this->Execute($query, $params);
|
|
return $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
}
|
|
}
|
|
|
|
$db = new DB();
|
|
?>
|