DH_Alumni/general.php

43 lines
1.0 KiB
PHP
Raw Permalink Normal View History

2021-04-20 09:41:25 +02:00
<?php
$db = getDatabase();
2021-04-20 09:41:25 +02:00
2021-04-21 10:17:02 +02:00
function getConfig() {
return parse_ini_file('config.ini.php');
}
function getDatabase(): PDO {
2021-04-21 10:17:02 +02:00
$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();
2021-04-21 10:17:02 +02:00
}
}
2021-04-20 09:41:25 +02:00
function returnHeader() {
?>
<!Doctype html>
<html lang="de">
<head>
2021-04-23 09:17:58 +02:00
<title><?php echo getConfig()["title"] ?></title>
2021-04-21 10:17:02 +02:00
<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">
2021-04-20 11:22:09 +02:00
<link href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css" rel="stylesheet">
2021-04-21 10:17:02 +02:00
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
2021-04-20 09:41:25 +02:00
</head>
<body>
2021-04-21 10:17:02 +02:00
2021-04-20 09:41:25 +02:00
<?php
}
function returnFooter() {
?>
</body>
</html>
<?php
}