Initial Commit

This commit is contained in:
DOMINIK SCHRADER
2025-12-01 11:30:25 +01:00
commit 007dfc57fd
20 changed files with 1313 additions and 0 deletions

24
config/database.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
class Database {
private $host = "localhost";
private $db_name = "sportanmeldung";
private $username = "admin";
private $password = "13!Q95dqW`T";
public $conn;
public function getConnection() {
$this->conn = null;
try {
$dsn = "mysql:host={$this->host};dbname={$this->db_name};charset=utf8mb4";
error_log("Versuche Datenbankverbindung: " . $dsn);
$this->conn = new PDO($dsn, $this->username, $this->password);
$this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
error_log("Datenbankverbindung erfolgreich");
} catch(PDOException $e) {
error_log("Connection Error: " . $e->getMessage());
return null;
}
return $this->conn;
}
}