bonjour,
je suis en bts devlopement et je doit céer un site web pour un projet. seulement voilà je n'arrive pas a coder ma page d'incription
donc j'ai taper mon formulaire (page 'inscriptio') :
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Inscriptions</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<?php
include("includes/fonction.php");
?>
<!-- Bandeau de tête !-->
<div id="global">
<div id="head">
<div id="logo">
<div id="banniere_image">
<div id="banniere_description">
Projet INSTA - Benjamin Pasquier & Mickael Néré
</div>
</div>
</div>
</div>
<!-- Liste des boutons !-->
<div id="menu">
<ul>
<li><a href="index.php" title="">Accueil</a></li>
<li><a href="inscription.php" title="">Inscription</a></li>
<li><a href="#" title="">Gestion Profil</a></li>
<li><a href="#" title="">Contactez nous !</a></li>
</ul>
<form action="" method="post">
<input type="text" name="login" placeholder="Pseudo" size="15px"/>
<input type="password" name="password" placeholder="Password" size="15px"/>
<input type="submit" value="Valider" />
</form>
</div>
</div>
<!-- Contenu Principal !-->
<div id="dernier-post-1">
<img src="images/we-want-you.jpg" alt="" width="370" height="370" class="right" />
<div id="dernier-post" class="post">
<form id="monForm" action="#" method="post">
<fieldset>
<p class="byline"><span>Informations Générales</span></p>
<p><label> Nom : </label>
<input type='text' maxlength='30' name='nom'></p>
<p><label> Prenom : </label>
<input type='text' maxlength='30' name='prenom'></p>
<p><label>Sexe : </label>
<select id="form_gender" name="genre">
<option label='femme'value='femme' ></option>
<option label='homme' value='homme'></option>
</select></p>
<p><label>Date de naissance : </label>
<input type="text" id="form_birthday" class="form_input_day_month" name="day" />
<input type="text" class="form_input_day_month" name="month" />
<input type="text" class="form_input_year" name="year" /></p>
<p><label>Pays : </label>
<select id="form_country" name="country">
<optgroup label="Amérique">
<option value="ca">Canada</option>
<option value="us">États-Unis</option>
</optgroup>
<optgroup label="Europe">
<option value="be">Belgique</option>
<option value="fr">France</option>
</optgroup>
</select></p>
</fieldset>
<fieldset>
<p class="byline"><span>Compte</span></p>
<p><label> Idantifiant : </label>
<input type='text' maxlength='30' name='login'></p>
<p><label> Mot de passe : </label>
<input type='password' maxlength='30' name='password'></p>
<p><label> Confirmer : </label>
<input type='password' maxlength='30' name='confpassword'></p>
<p><label> Mail : </label>
<input type='text' name='e_mail'></p>
<p><label> Confirmer mail : </label>
<input type='text' name='confe_mail'></p>
<p>
<label class="form_label_nostyle"> </label>
<input type="submit" name="submit" />
<input type="reset" name="del" />
</p>
</fieldset>
</form>
<?php
{
$login=$_POST['login'];
$password=$_POST['password'];
$confpassword=$_POST['confpassword'];
$e_mail=$_POST['e_mail'];
$confe_mail=$_POST['confe_mail'];
checkpseudo($login);
$fpseudo=checkpseudo($login);
checkmdp($password, $confpassword);
$fmdp=checkmdp($password, $confpassword);
checkmail ($e_mail, $confe_mail);
$fmail=checkmail ($e_mail, $confe_mail);
if($fpseudo='ok' && $fmail='ok' && $fmdp="mot de passe ok")
{
try
{
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
$bdd = new PDO('mysql:host=localhost;dbname=projet_1', 'root', '', $pdo_options);
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
$req= $bdd->prepare('INSERT INTO inscription (login, password, e_mail, nom, prenom, genre, day, country)VALUES(?,?,?,?,?,?,?,?)');
$req->execute(array($_POST['login'], $_POST['password'],$_POST['e_mail'], $_POST['nom'], $_POST['prenom'], $_POST['genre'], $_POST['day'], $_POST['country']));
header ('location: index.php');
}
else
{
echo checkpseudo($login)."<br/>";
echo checkmdp($password)."<br/>";
echo checkmail ($e_mail)."<br/>";
}
}
?>
</div>
</div>
</body>
</html>
et les fonction :
function checkpseudo($login)
{
if($login == '')
{
return 'entez un login';
}
elseif (strlen($login)<3)
{
return 'login trop cour';
}
elseif (strlen($login)>33)
{
return'login trop long';
}
else
{
$result = sqlqery("SELECT COUNT(*) AS nbr FROM inscription WHERE login = '".mysqli_real_escape_string($login)."'",1);
global $queries;
$queries++;
if($result['nbr']>0)
{
return 'se pseudo est deja pris!!!';
}
else
{
return 'ok, c\'est bon vous pouvez choisir se login';
}
}
}
function checkmdp($password, $confpassword)
{
if($password == '')
{
return 'entrez un mot de passe';
}
elseif (strlen($password)<6)
{
return 'mot de passe trop cour';
}
elseif (strlen($password)>33)
{
return'mot de passe trop long';
}
else
{
if(!preg_match('#[0-9]{1,}#',$password))
{
return 'nofigure';
}
elseif(!preg_match('#[A-Z]{1,}#', $password))
{
return 'noupcap';
}
elseif($password!= $confpassword && $password != '' &&$confpassword != '')
{
return 'les 2 mot de passe sont differents';
}
else
{
return 'mot de passe ok';
}
}
}
function checkmail ($e_mail, $confe_mail)
{
if ($e_mail == '')
{
return 'e-mail vide';
}
else if (!preg_match('#^[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$#is', $e_mail))
{
return 'ceci n\'est pas une adresse mail';
}
else
{
$result = sqlqery ("SELECT COUNT (*) AS nbr FROM membres WHERE e_mail = '" .mysql_real_escape_string($e_mail)."'",1);
global $queries;
$queries++;
if ($result['nbr']>0)
{
return 'cette adresse mail a deja été enregistrée';
}
elseif($e_mail= $confe_mail && $e_mail!='' && $confe_mail!= '')
{
return 'les des adresse mail sont differentes';
}
else
{
return 'ok';
}
}
}
losque je testes le formulair il m'affiche le message d'erreur suivan:
( ! ) Notice: Undefined index: login in C:\wamp\www\projet_1bis\inscription.php on line 105
(idem pour password, confpassword, e_mail, confemail)
et Notice: Undefined index: password in C:\wamp\www\projet_1bis\inscription.php on line 128
au secour!!!!!
merci d'avance