DH_Alumni/general.php

43 lines
1.0 KiB
PHP

<?php
$db = getDatabase();
function getConfig() {
return parse_ini_file('config.ini.php');
}
function getDatabase(): PDO {
$config = getConfig();
try {
$host = $config['db_host'];
$database = $config['db_database'];
return new PDO("mysql:host=$host;dbname=$database", $config['db_user'], $config['db_password']);
}
catch(PDOException $e) {
echo $e->getMessage();
}
}
function returnHeader() {
?>
<!Doctype html>
<html lang="de">
<head>
<title><?php echo getConfig()["title"] ?></title>
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre.min.css">
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre-exp.min.css">
<link href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<?php
}
function returnFooter() {
?>
</body>
</html>
<?php
}