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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| <?php
// connesxion bdd
try {
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
$bdd = new PDO('mysql:host=localhost;dbname=mn_info', 'root', '', $pdo_options);
}catch (Exception $e){
die('Erreur : ' . $e->getMessage());
}
if(!empty($_POST['pseudo'])&& !empty($_POST['mdp'])) //verif que les champs soit pas vide
{
$reponse=$bdd->query('SELECT pseudo,mdp FROM formulaire');
if($reponse!=$pseudo && $reponse!=$mdp)
{
echo 'Mauvais pseudo ou mot de passe';
}
elseif ($reponse==$pseudo && $reponse==$mdp)
{
session_start();//si tout est ok on crée $_SESSION['pseudo']
$_SESSION['pseudo']=$pseudo;
?>
<p>Connexion réussi!!<br/>
<a href="acc.php"><strong>Accueil</strong></label></p>;
<?php
}
else
{
'Tous les champs doivet etre remplis';
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>MN-Iformatique.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" media="screen" type="text/css" title="Design" href="design.css" />
</head>
<body>
<div id="en_tete">
</div>
<?php include("menu.php");?>
<div id="corps">
<div id="formulaire">
<form method="post" action="connexion.php">
<p> <label for="pseudo">Pseudo</label><input type="text" name="pseudo" id="pseudo"/><br/>
<label for="mdp">Mot de passe</label><input type="password" name="mot de passe"/><br/>
<br/><input type="submit" name="connexion" value="Connexion"/>
</form>
</div>
</body>
</html> |
Partager