<?php
session_start();
$bdd = new PDO('mysql:host=localhost;dbname=cssserv_yadc', 'cssserv_yadc', 'geoffroy');
if(isset($_POST['formconnexion']))
{
$pseudoconnect = htmlspecialchars($_POST['pseudoconnect']);
$mdpconnect = sha1($_POST['mdpconnect']);
if(!empty($pseudoconnect) AND !empty($mdpconnect))
{
$requser = $bdd->prepare("SELECT * FROM membres WHERE pseudo = ? AND motdepasse = ?");
$requser->execute(array($pseudoconnect, $mdpconnect));
$userexist = $requser->rowCount();
if($userexist == 1)
{
$userinfo = $requser->fetch();
$_SESSION['id'] = $userinfo['id'];
$_SESSION['pseudo'] = $userinfo['pseudo'];
header("Location: profil.php?id=".$_SESSION['id']);
}
else
{
$erreur = "Votre identifiant ou votre mot de passe est incorrect";
}
}
else
{
$erreur = "Votre identifiant ou votre mot de passe est incorrect";
}
}
?>