aboutsummaryrefslogtreecommitdiff
path: root/fn/fn.php
diff options
context:
space:
mode:
Diffstat (limited to 'fn/fn.php')
-rw-r--r--fn/fn.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/fn/fn.php b/fn/fn.php
new file mode 100644
index 0000000..e64a9c4
--- /dev/null
+++ b/fn/fn.php
@@ -0,0 +1,28 @@
+secure
+
+session
+
+<?php
+function bddconnect($host, $bdname, $user, $password)
+{
+ try {
+ $bdd = new PDO('mysql:host=' . $host . ';dbname=' . $dbname . ';charset=utf8', $user, $password);
+ } catch (Exeption $e) {
+ die('Erreur : ' . $e->getMessage());
+ }
+ return $bdd;
+}
+
+function session()
+{
+ session_start();
+}
+
+function secure()
+{
+ if (!isset($_SESSION['id'])) {
+ header("location: /");
+ }
+}
+?>
+