<?php ob_start(); session_start(); require_once '../db/database.php'; spl_autoload_register('loadClass'); unset($_SESSION['loginError']); unset($_SESSION['creationSuccess']); //CONNEXION if (isset($_POST['user_login']) && isset($_POST['user_pass'])) { $resConnect = checkUserConnexion($_POST['user_login'], $_POST['user_pass']); if ($resConnect == 1) { $user = getUserByName($_POST['user_login']); $_SESSION['user'] = serialize($user); $_SESSION['username'] = $user->getUsername(); if ($user->getType() == 0) { header('Location: ../part/panelEnseignant.php'); } else { header('Location: ../part/main.php'); } } else { if ($resConnect == -2) { $_SESSION['loginError'] = "Nom d'utilisateur inconnu"; } else { if ($resConnect == -1) { $_SESSION['loginError'] = "Mauvais mot de passe"; } } $_SESSION['username'] = '******'; header('Location: ../part/accueil.php'); }
<script src="../lib/bootstrap/js/bootstrap.js"></script> <link rel="stylesheet" href="../lib/bootstrap/css/bootstrap.css"> <link rel="stylesheet" href="../css/customCSS.css"> </head> <body> <?php $currentPage = ''; include "../menus/inPageMenu.php"; ?> <?php //Traitement de la connexion if (isset($_POST['login']) && isset($_POST['pwd'])) { $status = checkUserConnexion($bdd, $_POST['login'], $_POST['pwd']); $message = ''; if ($status != false) { $userData = getUserData($bdd, $status); $_SESSION['lastName'] = $userData[0]; $_SESSION['firstName'] = $userData[1]; $_SESSION['credit'] = $userData[2]; $_SESSION['uid'] = $status; $_SESSION['cartTitles'] = array(); $_SESSION['cartDiscs'] = array(); $_SESSION['cartPrice'] = 0; header('Location: ../index.php'); } else { $message = "Échec de connexion. Raison : <strong> Couple identifiant/Mot de passe invalide </strong>"; } }