Modification du systeme de connexion a la bd

This commit is contained in:
remi.biette 2019-05-10 09:43:17 +02:00
parent a2e72de86c
commit 158d2825e0
4 changed files with 11 additions and 35 deletions

View File

@ -1,19 +1,7 @@
<?php <?php
/**
* Created by PhpStorm.
* User: REMI
* Date: 16/04/2019
* Time: 14:46
*/
function connexionBD(){
$host = "localhost"; $host = "localhost";
$dbname = "projet"; $dbname = "projet";
$user = "utilisateur"; $user = "utilisateur";
$pass = "-stri-"; $pass = "-stri-";
$db = pg_connect("host=$host port=5432 dbname=$dbname user=$user password=$pass") or die("Erreur lors de la connexion à la base de données."); $db = pg_connect("host=$host port=5432 dbname=$dbname user=$user password=$pass") or die("Erreur lors de la connexion à la base de données.");
return $db;
}
?>

View File

@ -1,21 +1,11 @@
<?php <?php
/**
* Created by PhpStorm.
* User: REMI
* Date: 19/04/2019
* Time: 10:10
*/
require 'connectionBD.php'; require_once 'connectionBD.php';
$db = connexionBD();
init();
function init(){
session_start(); session_start();
if (isset($_SESSION['mail'])){ if (isset($_SESSION['mail'])){
session_unset(); session_unset();
session_destroy(); session_destroy();
} }
header('Location: index.php'); header('Location: index.php');
exit();
}

View File

@ -1,7 +1,6 @@
<?php <?php
require("connectionBD.php"); require_once("connectionBD.php");
$db = connexionBD();
init(); init();
function printError(){ function printError(){

View File

@ -1,7 +1,6 @@
<?php <?php
require ('connectionBD.php'); require_once ('connectionBD.php');
$db = connexionBD();
init(); init();
function printError(){ function printError(){