page de connexion fonctionnelle avec bdd

This commit is contained in:
Pierr0
2024-01-02 17:42:42 +01:00
parent 85c00fde0a
commit 9f245f6578
10 changed files with 161 additions and 21 deletions

View File

@@ -1,12 +1,35 @@
<?php
// ***************************************'
// Le CASTEL-BTS SIO/ PROJET PPE4 GSB '
// Programme: c_connexion.php v2.0 '
// Objet : gestion remboursements frais'
// Client : laboratoires GSB '
// Date : 03/05/2023 à 11H01 '
// Auteur : pascal-blain@wanadoo.fr '
//****************************************'
require_once(__DIR__ . '/../Class/class.user.php');
$userClass = new Class_user($pdo);
if (isset($_POST['login']) && isset($_POST['password'])) {
//Récupère les données de l'utilisateur
$data = $userClass->connectUser($_POST['login'], $_POST['password']);
//Si l'utilisateur existe ou pas
if (count($data) === 0) {
header('location: index.php?direction=connexion&msg=errorco');
} else {
$_SESSION['uId'] = $data['uId'];
$_SESSION['uNom'] = $data['uNom'];
$_SESSION['uPrenom'] = $data['uPrenom'];
$_SESSION['uAdresse'] = $data['uAdresse'];
$_SESSION['uCp'] = $data['uCp'];
$_SESSION['uVille'] = $data['uVille'];
$_SESSION['uSecteur'] = $data['uSecteur'];
$_SESSION['uLabo'] = $data['uLabo'];
$_SESSION['uType'] = $data['pLibelle'];
header('location: index.php?direction=home');
}
} else {
header('location: index.php');
}
die;
/*
header('location: index.php?direction=home');
if (!isset($_REQUEST['action'])) {
@@ -44,7 +67,7 @@ switch ($action) {
$leMoisPrecedent = (date('Y') - 1) * 100 + 12;
}
//penser ici à faire la cloture du mois précédent !
if ($statut == 'V') /* si le remboursement pour le mois courant n'existe pas (=0) il faut le créer*/{
if ($statut == 'V') // si le remboursement pour le mois courant n'existe pas (=0) il faut le créer{
$leMois = date('Ym');
$leRemboursement = $pdo->existeRemboursement($id, $leMois);
if ($leRemboursement == 0) {
@@ -61,4 +84,5 @@ switch ($action) {
break;
}
}
?>
?>
*/

View File

@@ -0,0 +1,5 @@
<?php
session_start();
session_destroy();
header('location: ../index.php');

View File

@@ -5,6 +5,8 @@ $newFiche = new Class_newFiche($pdo);
$_SESSION['userId'] = 'b34';
$_SESSION['typeU'] = 'visiteur';
$typeUser = $_SESSION['uType'];
$userId = $_SESSION['uId'];
$date = '202011';
/**
@@ -42,7 +44,7 @@ if (isset($_GET['currentList'])) {
/**
* Liste des frais forfaitaires du mois et de l'user :: sinon afficher les libelle
*/
$listeFraisForfaitaire = $newFiche->listFraisForfaitForU($_SESSION['userId'], $date);
$listeFraisForfaitaire = $newFiche->listFraisForfaitForU($userId, $date);
if (count($listeFraisForfaitaire) == 0) {
$listeFraisForfaitaire = $newFiche->listFraisForfaitaires();
}
@@ -50,11 +52,11 @@ if (count($listeFraisForfaitaire) == 0) {
/**
* Listes des frais HF
*/
$listeFraisHf = $newFiche->listFraisHF($_SESSION['userId'], $date);
$listeFraisHf = $newFiche->listFraisHF($userId, $date);
/**
* TOTAL DE LA FICHE
*/
$totalFraisFiche = $newFiche->getMontantValide($_SESSION['userId'], $date);
$totalFraisFiche = $newFiche->getMontantValide($userId, $date);
include(__DIR__ . '/../vues/v_newFiche.php');