summaryrefslogtreecommitdiff
path: root/intern.gospeladlershof.de/code/db.php
diff options
context:
space:
mode:
authorHorus2016-09-27 20:02:34 +0200
committerHorus2016-09-27 20:02:34 +0200
commita3ca59de099d04b849b368f5867dd79c52e0424a (patch)
treea65b18429e86437a7d0a96ab790dd26b51c8a3aa /intern.gospeladlershof.de/code/db.php
parentf70f746b5951e29eef449f962d5f531ed4a5961f (diff)
downloadgospeladlershof.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.php25
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;
+}
+