1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
   | <?php session_start();?>
<?php if($_POST['connexionAuto']){setcookie('pseudo', $_POST['identifiant'], time() + 365*24*3600,'/', FALSE, FALSE);} ?>
 
 
<?php
 
    try{$bdd=new PDO('mysql:host=*******;dbname=*******;charset=utf8','********','*******', array(PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION));}
    catch(Exception $e){die('Erreur :'.$e->getMessage());}
 
    // Hachage du mot de passe
    $pass_hache = sha1($_POST['password']);
 
    // Vérification des identifiants
    $req = $bdd->prepare('SELECT id FROM espace_membres WHERE pseudo = :pseudo AND pass = :password');
    $req->execute(array(
        'pseudo' =>htmlspecialchars( $_POST['identifiant']),
        'password' => $pass_hache));
 
 
    if($_POST['connexionAuto']){setcookie('Pcrypt', $pass_hache, time() + 365*24*3600,'/', FALSE, FALSE);}
 
 
    $resultat = $req->fetch();
 
 
    if (!$resultat)
    {
        echo "<script>location='/parametresErreur.php'</script>";
 
    }
    else
    {
 
        $_SESSION['id'] = $resultat['id'];
        $_SESSION['pseudo'] = $_POST['identifiant'];
       echo "<script>location='/parametres.php'</script>";
    } | 
Partager