includes, style.css, Basis

This commit is contained in:
p3t3rp1Lz 2026-04-01 20:04:26 +02:00
parent 6623a07f66
commit e6a0acfde0
3 changed files with 40 additions and 1 deletions

14
includes/db_connect.php Normal file
View File

@ -0,0 +1,14 @@
<?php
$host = getenv('POSTGRES_HOST');
$db = getenv('POSTGRES_DB');
$user = getenv('POSTGRES_APPUSER');
$pass = getenv('POSTGRES_APPPASSWORD');
$port = getenv('POSTGRES_PORT');
try {
$dsn = "pgsql:host=$host;port=$port;dbname=$db;";
$pdo = new PDO($dsn, $user, $pass, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
} catch (PDOException $e) {
echo "Verbindungsfehler: " . $e->getMessage();
}
?>

View File

@ -1,3 +1,20 @@
<?php <?php
echo "Hello World!"; require_once __DIR__ . '/includes/db_connect.php';
$system = getenv('POSTGRES_SYSTEM') ?? 'test';
$stmt = $pdo->query("SELECT vorderseite
FROM karteikarte;");
$karteikarten = $stmt->fetchAll(PDO::FETCH_ASSOC);
?> ?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<?php foreach ($karteikarten as $y): ?>
<p>Vorderseite: <?= $y['vorderseite'] ?></p>
<?php endforeach; ?>
</body>
</html>

8
style.css Normal file
View File

@ -0,0 +1,8 @@
html {
font-size: 16px;
font-family: Arial, Helvetica, sans-serif;
}
body {
background-color: rgb(122, 122, 122);
}