site-accueil-insa/script/db.php

12 lines
336 B
PHP
Raw Normal View History

2022-01-21 02:50:15 +01:00
<?php
function read_password()
{
$real_path = __DIR__.DIRECTORY_SEPARATOR.".htpassdb";
$file = fopen($real_path, "r") or die("Unable to open DB password file!");;
$password = fgets($file);
fclose($file);
return trim($password);
}
$db = new PDO('mysql:host=127.0.0.1;dbname=accueil_insa','root', read_password());
?>