Bonjour j'essaie de réunir mais fichier d'inscriptions en un seul , le soucis je n'arrive pas je fait sur une erreur mais je vois pas la quel une aide serai la bienvenue .
Merci d'avance.
la partie formulaire réuni
<?php
// Le si form a été envoyé, on traite
if(!empty($_POST['inscription']))
{
$nom_m = addslashes($_POST['nom_m']);
$email = addslashes($_POST['email']);
$email_2 = addslashes($_POST['email_2']);
$sexe = addslashes($_POST['sexe']);
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("Y-m-d");
$quipass = date("Y-m-d");
$heure = date("H:i:s");
$heurepass = date("H:i:s");
$_SESSION['security_code'] = $_POST['security_code'];
// Divers traitements
if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
// Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
unset($_SESSION['security_code']);
$form_ok = 1;
}
$motif_nom ='/^[a-z\d_]{3,12}$/i';
$motif_email ='/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/';
$motif_email_2 ='/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/';
if ((!preg_match($motif_nom,$nom_m)) && (!preg_match($motif_email,$email)) && (!preg_match($motif_email_2,$email_2)))
{
$form_ok=1;
}
//vérication les deux email sont exact
if($email!=$email_2)
{
$form_ok = 1;
}
/////////////////////////////////////teste le nom dans la base de donnée///////////////////////////////////////
$texts_exist=mysql_query("SELECT email FROM comptes WHERE nom='$nom'") or die (mysql_error());
$test_nom_nb=mysql_num_rows($texts_exist);
if(!$test_nom_nb==0)
{
$form_ok = 1;
}
///////////////////////////////test email si elle est dans la base////////////////////////////////////////
$text_exist=mysql_query("SELECT email FROM comptes WHERE email='$email'") or die (mysql_error());
$test_email_nb=mysql_num_rows($text_exist);
if(!$test_email_nb==0)
{
$form_ok = 1;
}
else
{
$form_erreur = "Le nom doit être rempli! Non mais!<br />";
}
$taille = 20;
$lettres = "abcdefghijklmnopqrstuvwxyz0123456789AZERTYUIOPMLKJHGFDSQWXCVBN";
srand(time());
for ($i=0;$i<$taille;$i++)
{
@$idm.=substr($lettres,(rand()%(strlen($lettres))),1);
}
// Creation d'un identifiant
$tail = 8;
$lett = "abcdefghijklmnopqrstuvwxyz0123456789";
srand(time());
for ($i=0;$i<$tail;$i++)
{
@$pass2.=substr($lett,(rand()%(strlen($lett))),1);
}
$pass1=md5($pass2);
@mysql_query("INSERT INTO comptes (idX, idm, nom, pass, email, sexe, ip, date, quipass, heure, heurepass)
VALUES ('',
'".mysql_real_escape_string($idm)."',
'".mysql_real_escape_string($nom_m)."',
'".mysql_real_escape_string($pass1)."',
'".mysql_real_escape_string($email)."',
'".mysql_real_escape_string($sexe)."',
'".mysql_real_escape_string($ip)."',
'".mysql_real_escape_string($date)."',
'".mysql_real_escape_string($quipass)."',
'".mysql_real_escape_string($heure)."',
'".mysql_real_escape_string($heurepass)."')")
or die (mysql_error());
}
if(@$form_ok!=1)
{
// S'il y a une erreur on l'affiche
if(!empty($form_erreur))
{
print "<p>".$form_erreur."</p>";
}
// Mon formulaire
echo'<table width="99%" height="308" border="0" />
<tr>
<td width="47%" height="304">
<form method="post" name="inscription" action="'.$_SERVER['PHP_SELF'].'" />
<table width="429" border="0" align="center" />
<tr>
<td width="423">
<table width="100%" border="0">
<tr>
<td> </td>
</tr>
<tr bgcolor="#0099CC">
<td>
<div align="center"><font color="#FFFFFF"><b>Inscription</b></font></div>
</td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td width="37%"><b>'.$nom_lang.'<img src="design/force.gif" width="16" height="16" /> :</b></td>
<td width="63%">
<input class="input" type="text" name="nom_m" value="'.stripslashes(@$nom_m).'" />
</td>
</tr>
<tr>
<td width="37%"><b>'.$email_lang.'<img src="design/force.gif" width="16" height="16" /> :</b></td>
<td width="63%">
<input class="input" type="text" name="email" value="'.stripslashes(@$email).'" />
</td>
</tr>
<tr>
<td width="37%"><b>'.$email_2_lang.'<img src="design/force.gif" width="16" height="16" border="0" /> :</b></td>
<td width="63%">
<input class="input" type="text" name="email_2" value="'.stripslashes(@$email_2).'">
</td>
</tr>
<tr>
<td></td>
<td><p><b>Mr :</b>
<input class="input" type="radio" name="sexe" value="H" checked/>
<b>Mme :</b>
<input class="input" type="radio" name="sexe" value="F" />
</p>
<p><b>Pro :</b><input class="input" type="radio" name="sexe" value="pro" /></p></td>
</tr>
<tr>
<td width="37%"><b>'.$sk.'</b></td>
<td width="63%">
<img src="CaptchaSecurityImages.php??rand= rand()" id="captchaimg" /><br />
</label><input class="input" id="security_code" name="security_code" type="text" /><br />
<small>'.$sk1.' <a href="javascript: refreshCaptcha();">'.$sk2.'</a> '.$sk3.'</small>
</td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td>
<center><input type="submit" name="Submit" value="'.$valide.'"></center>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<script language="JavaScript" type="text/javascript">
function refreshCaptcha()
{
vvar img = document.images["captchaimg"];
img.src = img.src.substring(0,img.src.lastIndexOf("?"))+"?rand="+Math.random()*1000;
}
</script>
<br /><br />
</td>
</tr>
</table>';
}
else
{
echo ("<center><br /><br /><b>Votre inscription a réussi.</b><br />");
echo ("Veuillez-vous connecter pour accéder à l'espace membre.<br /><br />");
echo ("<a href=\"index.php\">Se connecter</font></a><br /><br /><br /><br /></center>");
////////////////////////////////////////////////envois mail password /////////////////////////////////
$body="Bonjour $nom,\n\nVous venez de vous inscrire sur le site http://www.h-immo.be\nVeuillez ne pas perdre ce mail pour pourvoir vous identifier a nouveau\n\nVoici les informations que vous avez saisi:\n\nNom: $nom\n\nAdresse Email: $email \n\nPassword: $pass2";
@mail("$nom <$email>","Confirmation de l'inscription sur h-immo.be",$body, "From: h-immo.be <[email protected]>");
@mysql_query("INSERT INTO infoscomptes (nom) VALUES('$nom')") or die (mysql_error());
}
mysql_close();
?>
Bonjour j'essaie de réunir mais fichier d'inscriptions en un seul , le soucis je n'arrive pas je fait sur une erreur mais je vois pas la quel une aide serai la bienvenue .
Merci d'avance.
la partie formulaire réuni
[php]<?php
// Le si form a été envoyé, on traite
if(!empty($_POST['inscription']))
{
$nom_m = addslashes($_POST['nom_m']);
$email = addslashes($_POST['email']);
$email_2 = addslashes($_POST['email_2']);
$sexe = addslashes($_POST['sexe']);
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("Y-m-d");
$quipass = date("Y-m-d");
$heure = date("H:i:s");
$heurepass = date("H:i:s");
$_SESSION['security_code'] = $_POST['security_code'];
// Divers traitements
if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
// Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
unset($_SESSION['security_code']);
$form_ok = 1;
}
$motif_nom ='/^[a-z\d_]{3,12}$/i';
$motif_email ='/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/';
$motif_email_2 ='/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/';
if ((!preg_match($motif_nom,$nom_m)) && (!preg_match($motif_email,$email)) && (!preg_match($motif_email_2,$email_2)))
{
$form_ok=1;
}
//vérication les deux email sont exact
if($email!=$email_2)
{
$form_ok = 1;
}
/////////////////////////////////////teste le nom dans la base de donnée///////////////////////////////////////
$texts_exist=mysql_query("SELECT email FROM comptes WHERE nom='$nom'") or die (mysql_error());
$test_nom_nb=mysql_num_rows($texts_exist);
if(!$test_nom_nb==0)
{
$form_ok = 1;
}
///////////////////////////////test email si elle est dans la base////////////////////////////////////////
$text_exist=mysql_query("SELECT email FROM comptes WHERE email='$email'") or die (mysql_error());
$test_email_nb=mysql_num_rows($text_exist);
if(!$test_email_nb==0)
{
$form_ok = 1;
}
else
{
$form_erreur = "Le nom doit être rempli! Non mais!<br />";
}
$taille = 20;
$lettres = "abcdefghijklmnopqrstuvwxyz0123456789AZERTYUIOPMLKJHGFDSQWXCVBN";
srand(time());
for ($i=0;$i<$taille;$i++)
{
@$idm.=substr($lettres,(rand()%(strlen($lettres))),1);
}
// Creation d'un identifiant
$tail = 8;
$lett = "abcdefghijklmnopqrstuvwxyz0123456789";
srand(time());
for ($i=0;$i<$tail;$i++)
{
@$pass2.=substr($lett,(rand()%(strlen($lett))),1);
}
$pass1=md5($pass2);
@mysql_query("INSERT INTO comptes (idX, idm, nom, pass, email, sexe, ip, date, quipass, heure, heurepass)
VALUES ('',
'".mysql_real_escape_string($idm)."',
'".mysql_real_escape_string($nom_m)."',
'".mysql_real_escape_string($pass1)."',
'".mysql_real_escape_string($email)."',
'".mysql_real_escape_string($sexe)."',
'".mysql_real_escape_string($ip)."',
'".mysql_real_escape_string($date)."',
'".mysql_real_escape_string($quipass)."',
'".mysql_real_escape_string($heure)."',
'".mysql_real_escape_string($heurepass)."')")
or die (mysql_error());
}
if(@$form_ok!=1)
{
// S'il y a une erreur on l'affiche
if(!empty($form_erreur))
{
print "<p>".$form_erreur."</p>";
}
// Mon formulaire
echo'<table width="99%" height="308" border="0" />
<tr>
<td width="47%" height="304">
<form method="post" name="inscription" action="'.$_SERVER['PHP_SELF'].'" />
<table width="429" border="0" align="center" />
<tr>
<td width="423">
<table width="100%" border="0">
<tr>
<td> </td>
</tr>
<tr bgcolor="#0099CC">
<td>
<div align="center"><font color="#FFFFFF"><b>Inscription</b></font></div>
</td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td width="37%"><b>'.$nom_lang.'<img src="design/force.gif" width="16" height="16" /> :</b></td>
<td width="63%">
<input class="input" type="text" name="nom_m" value="'.stripslashes(@$nom_m).'" />
</td>
</tr>
<tr>
<td width="37%"><b>'.$email_lang.'<img src="design/force.gif" width="16" height="16" /> :</b></td>
<td width="63%">
<input class="input" type="text" name="email" value="'.stripslashes(@$email).'" />
</td>
</tr>
<tr>
<td width="37%"><b>'.$email_2_lang.'<img src="design/force.gif" width="16" height="16" border="0" /> :</b></td>
<td width="63%">
<input class="input" type="text" name="email_2" value="'.stripslashes(@$email_2).'">
</td>
</tr>
<tr>
<td></td>
<td><p><b>Mr :</b>
<input class="input" type="radio" name="sexe" value="H" checked/>
<b>Mme :</b>
<input class="input" type="radio" name="sexe" value="F" />
</p>
<p><b>Pro :</b><input class="input" type="radio" name="sexe" value="pro" /></p></td>
</tr>
<tr>
<td width="37%"><b>'.$sk.'</b></td>
<td width="63%">
<img src="CaptchaSecurityImages.php??rand= rand()" id="captchaimg" /><br />
</label><input class="input" id="security_code" name="security_code" type="text" /><br />
<small>'.$sk1.' <a href="javascript: refreshCaptcha();">'.$sk2.'</a> '.$sk3.'</small>
</td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td>
<center><input type="submit" name="Submit" value="'.$valide.'"></center>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<script language="JavaScript" type="text/javascript">
function refreshCaptcha()
{
vvar img = document.images["captchaimg"];
img.src = img.src.substring(0,img.src.lastIndexOf("?"))+"?rand="+Math.random()*1000;
}
</script>
<br /><br />
</td>
</tr>
</table>';
}
else
{
echo ("<center><br /><br /><b>Votre inscription a réussi.</b><br />");
echo ("Veuillez-vous connecter pour accéder à l'espace membre.<br /><br />");
echo ("<a href=\"index.php\">Se connecter</font></a><br /><br /><br /><br /></center>");
////////////////////////////////////////////////envois mail password /////////////////////////////////
$body="Bonjour $nom,\n\nVous venez de vous inscrire sur le site http://www.h-immo.be\nVeuillez ne pas perdre ce mail pour pourvoir vous identifier a nouveau\n\nVoici les informations que vous avez saisi:\n\nNom: $nom\n\nAdresse Email: $email \n\nPassword: $pass2";
@mail("$nom <$email>","Confirmation de l'inscription sur h-immo.be",$body, "From: h-immo.be <
[email protected]>");
@mysql_query("INSERT INTO infoscomptes (nom) VALUES('$nom')") or die (mysql_error());
}
mysql_close();
?>
[/php]