diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2018-03-17 11:19:05 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2018-03-17 11:33:03 +0100 |
commit | 53a5f6b267b1deb8c5f10973c1a238ff74a33e5a (patch) | |
tree | d3d3611a6aa31023fd911fced4906e72188647b3 /fn/fn.php | |
download | wcms-53a5f6b267b1deb8c5f10973c1a238ff74a33e5a.tar.gz wcms-53a5f6b267b1deb8c5f10973c1a238ff74a33e5a.zip |
Commit initial
Diffstat (limited to 'fn/fn.php')
-rw-r--r-- | fn/fn.php | 28 |
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: /"); + } +} +?> + |