//Si on est pas connecté redirection vers la page de connexion
if(!isset($_SESSION['mail'])){
header('Location: ../index.php');
exit();
}
else{
$mail = $_SESSION['mail'];
}
showVoiture($db);
}
function getPrenom($mail){
global $db;
function getPrenom($db, $mail){
$result = pg_query_params($db, "SELECT prenom from Utilisateur WHERE mail = $1;", array($mail));
if($result){
$row = pg_fetch_array($result);
@ -47,8 +39,7 @@ function getPrenom($mail){
return null;
}
function getLogin($mail){
global $db;
function getLogin($db, $mail){
$result = pg_query_params($db, "SELECT login from Utilisateur WHERE mail = $1;", array($mail));
if($result){
$row = pg_fetch_array($result);
@ -58,8 +49,7 @@ function getLogin($mail){
return null;
}
function getTrajetsProposes($mail){
global $db;
function getTrajetsProposes($db, $mail){
$result = pg_query_params($db, "SELECT COUNT(*) from Trajet WHERE mailProposition = $1 AND estAnnule = false AND datedepart >= current_date;", array($mail));
if($result){
$row = pg_fetch_array($result);
@ -68,8 +58,7 @@ function getTrajetsProposes($mail){
return 0;
}
function getTrajetsReserves($mail){
global $db;
function getTrajetsReserves($db, $mail){
$result = pg_query_params($db, "SELECT COUNT(*) FROM trajet tr, reserver r WHERE r.codetrajet = tr.codetrajet AND mailutilisateur = $1 AND etatres != 'Annulée' AND estAnnule = false AND datedepart >= current_date;", array($mail));
if($result){
$row = pg_fetch_array($result);
@ -78,8 +67,7 @@ function getTrajetsReserves($mail){
return 0;
}
function getMessagesNonLus($mail){
global $db;
function getMessagesNonLus($db, $mail){
$result = pg_query_params($db, "SELECT COUNT(*) from Message WHERE mailRecepteur = $1 AND estLu = FALSE;", array($mail));
if($result){
$row = pg_fetch_array($result);
@ -88,7 +76,7 @@ function getMessagesNonLus($mail){
}
}
function getAvisNonLus($mail){
function getAvisNonLus($db, $mail){
global $db;
$result = pg_query_params($db, "SELECT COUNT(tr.mailProposition) FROM Trajet tr, Avis av WHERE tr.codeTrajet = av.codeTrajet AND av.estLu = false AND tr.mailProposition = $1;", array($mail));
if($result){
@ -105,21 +93,18 @@ function getPathImgProfil($mail){
return "../imageProfil/default.svg";
}
function addVoiture($matricule, $marque, $modele, $nbplaces, $anneefab){
global $db;
function addVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab){