diff options
| author | Horus | 2016-09-27 20:02:34 +0200 |
|---|---|---|
| committer | Horus | 2016-09-27 20:02:34 +0200 |
| commit | a3ca59de099d04b849b368f5867dd79c52e0424a (patch) | |
| tree | a65b18429e86437a7d0a96ab790dd26b51c8a3aa /intern.gospeladlershof.de/code/db.php | |
| parent | f70f746b5951e29eef449f962d5f531ed4a5961f (diff) | |
| download | gospeladlershof.de-a3ca59de099d04b849b368f5867dd79c52e0424a.tar.gz | |
Fügt das Backend erneut hinzu.
Diffstat (limited to 'intern.gospeladlershof.de/code/db.php')
| -rw-r--r-- | intern.gospeladlershof.de/code/db.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/intern.gospeladlershof.de/code/db.php b/intern.gospeladlershof.de/code/db.php new file mode 100644 index 0000000..8385ed5 --- /dev/null +++ b/intern.gospeladlershof.de/code/db.php @@ -0,0 +1,25 @@ +<?php +function get_db() { + require_once __DIR__ . '/config.php'; + require_once __DIR__ . '/secrets.php'; // beinhaltet die Parameter für die Datenbank + + try { + $db = new pdo($dsn, $db_user, $db_passwd); + } catch (Exception $e) { + error_log($e->getMessage()); + + unset($dsn); + unset($db_user); + unset($db_passwd); + + return false; + } + $db->exec('SET CHARACTER SET utf8'); + + unset($dsn); + unset($db_user); + unset($db_passwd); + + return $db; +} + |
