Exemple #1
0
 $login = $_REQUEST['login'];
 $mdp = $_REQUEST['mdp'];
 $tabInfo = $pdo->getInfosUtilisateur($login, $mdp);
 //Teste si l'identifiant et le mot de passe sont bons
 if (sizeof($tabInfo) > 1) {
     //Si oui, affiche la page d'accueil et le sommaire
     $_SESSION["login"] = $login;
     $_SESSION["connecte"] = 1;
     $_SESSION["util"] = $tabInfo["idUtil"];
     $_SESSION["age"] = $tabInfo["age"];
     $_SESSION["ageDebut"] = $tabInfo["ageDebut"];
     $_SESSION["nbCigarettes"] = $tabInfo["nbCigarettes"];
     $_SESSION["marque"] = $tabInfo["marque"];
     $_SESSION["argentDepense"] = argentDepense($_SESSION["age"], $_SESSION["ageDebut"], $_SESSION["nbCigarettes"], $_SESSION["marque"]);
     $_SESSION["dateArret"] = convertDateBdToSite($tabInfo["dateArret"]);
     $_SESSION["argentEconomise"] = argentEconomise($_SESSION["dateArret"], $_SESSION["nbCigarettes"], $_SESSION["marque"]);
     $_SESSION["idObjC"] = $tabInfo["idObjC"];
     $_SESSION["objCourt"] = $tabInfo["nomObjC"];
     $_SESSION["prixObjCourt"] = $tabInfo["prixObjC"];
     $_SESSION["idObjM"] = $tabInfo["idObjM"];
     $_SESSION["objMoyen"] = $tabInfo["nomObjM"];
     $_SESSION["prixObjMoyen"] = $tabInfo["prixObjM"];
     $_SESSION["idObjL"] = $tabInfo["idObjL"];
     $_SESSION["objLong"] = $tabInfo["nomObjL"];
     $_SESSION["prixObjLong"] = $tabInfo["prixObjL"];
     $_SESSION["choixObjectifs"] = $tabInfo["choixObjectifs"];
     $_SESSION["mail"] = $tabInfo["mail"];
     $_SESSION["reveDepasse"] = nbRevesDepasse($_SESSION["argentDepense"], $_SESSION["prixObjLong"]);
     $pdo->majArgentEconomise($_SESSION["login"], floatval($_SESSION["argentEconomise"]));
     $pdo->majArgentDepense($_SESSION["login"], $_SESSION["argentDepense"]);
     include 'vues/v_accueil.php';
<?php

include "include/fonctions.php";
$argentEconomise = argentEconomise("25/05/2015", $_SESSION["nbCigarettes"], $_SESSION["marque"]);
$pourcentageCourt = pourcentageObjectif($argentEconomise, $_SESSION["prixObjCourt"]);
$pourcentageMoyen = pourcentageObjectif($argentEconomise, $_SESSION["prixObjMoyen"]);
$pourcentageLong = pourcentageObjectif($argentEconomise, $_SESSION["prixObjLong"]);
//$pdo->updateNewUtil($idUtil,$age,$ageDebut,$nbCig,$marque,$argentDepense,
//$argentEconomise,$dateArret,$choixObjectifs);
if ($_SESSION["choixObjectifs"] == 1) {
    include "vues/v_sommaire.php";
    include "vues/v_motivation.php";
} else {
    include "vues/v_sommaire.php";
    include "vues/v_definirObj.php";
}