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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
<!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">
<h2>Formulaire d'inscription</h2>
<form method="post" action="formulaire.php">
<fieldset>
<p>
<br/><br/> <label for="pseudo">Pseudo :</label> <input type="text" name="pseudo" id="pseudo" maxlength="15"/>
<br/><br/> <label for="mdp">Mot de passe :</label> <input type="password" name="mdp" id="mdp" maxlength="15"/>
<br/><br/> <label for="mail">Mail :</label> <input type="text" name="mail" id="mail"maxlength="50"/>
<br/><br/> <label for="confirm_mail">Confirmation mail :</label> <input type="text" name="confirm_mail" id="confirm_mail" maxlength="50"/>
</fieldset>
<input type="submit" name="valider" value="Valider"/> <input type="reset" />
</p>
</form>
<?php
// connexion a 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());
}
?>
<?php
// on verifie que tous les champs soit remplis
if(
!empty($_POST['pseudo'])
&&!empty($_POST['mdp'])
&&!empty($_POST['mail'])
&&!empty($_POST['confirm_mail']))
{
if($_POST['mail']==$_POST['confirm_mail']) //on verifie que les adresses soit les meme
{
$req=$bdd->prepare('INSERT INTO formulaire(pseudo,mdp,mail)VALUES (?,?,?)');
$req->execute(array(
$_POST['pseudo'],
md5($_POST['mdp']),
$_POST['mail']));
echo 'Inscription valide merci de la confirmer dans le mail que vous avez recu ';
}
}
elseif (isset($_POST['mail'])!=($_POST['confirm_mail']))
{
echo 'Les deux adresses mail doivent etre les meme';
}
elseif (!empty($_POST['valider']))
{
echo 'Tous les champs doivent etre remplis';
}
?>
</div>
</div>
</body>
</html> |
Partager