Code : Tout sélectionner
<div id="login">
<form method="post" action="lndex.php">
<label for="pseudo"><img src="icon/header/acc2.png" alt="icon login" id="acc_head"/></label>
<input type="text" name="pseudo" id="pseudo" size="16" maxlength="16" placeholder="Pseudo" />
<label for="password"><img src="icon/header/key2.png" alt="icon key" id="key_head"/></label>
<input type="password" name="password" id="password" size="16" maxlength="16" placeholder="Password"/>
<input type="submit" value="" class="bouton_perso"/>
</form>
</div>donc j'ai noté sur ma page "lndex.php" (celle qui reçoit le <form> donc) avant doctype, le php : "include : session_start"
Code : Tout sélectionner
<?php include("boucles/php/fonction/session_start.php") ;?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="style.css" />
<title>Hardfive clan Esport</title>
</head>
<body>
<div id="bloc_page">
<?php include("inc/header.php"); ?>
<?php include("boucles/corps_ou_inscription.php")?>
<?php include("inc/menu_abc.php"); ?>
<?php include("inc/copyright.php"); ?>
</div>
</body>
</html>Code : Tout sélectionner
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=membres;charset=utf8', 'root', '', 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 * FROM membres WHERE pseudo = :pseudo AND pass = :pass');
$req->execute(array(
'pseudo' => $_POST['pseudo'],
'pass' => $_POST['password']));
$resultat = $req->fetch();
if (!$resultat)
{<br> echo "mauvais" ;<br> }
else
{
session_start();
$_SESSION['id'] = $resultat['id'];
$_SESSION['pseudo'] = $_POST['pseudo'];
echo "bonjour" ;
}
?>merci