diff options
Diffstat (limited to 'app/fn/fn.php')
-rw-r--r-- | app/fn/fn.php | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/app/fn/fn.php b/app/fn/fn.php index 8bfdee8..029e9d3 100644 --- a/app/fn/fn.php +++ b/app/fn/fn.php @@ -1,52 +1,13 @@ <?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 secure() +function class_autoloader($class) { - if (!isset($_SESSION['id'])) { - header("location: ./"); - } + require('.'. DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . strtolower($class) . '.php'); } -function head($title) -{ - ?> - <head> - <meta charset="utf8" /> - <meta name="viexport" content="width=device-width" /> - <link href="./css/style.css" rel="stylesheet" /> - <title><?= $title ?></title> - </head> - <?php -} -function search($haystack, $debut, $fin) -{ - $list = []; - - $indexdebut = strpos($haystack, $debut); - if ($indexdebut !== false) { - $indexdebut += strlen($debut); - $indexfin = strpos($haystack, $fin, $indexdebut); - if ($indexfin !== false) { - array_push($list, substr($haystack, $indexdebut, $indexfin - $indexdebut)); - $haystack = substr($haystack, $indexfin); - $list = array_merge($list, search($haystack, $debut, $fin)); - } - } - return $list; - -} function readablesize($bytes) { |