Seriez vous m'aidez svp?
Merci d'avance
<?PHP
function Rec($text)
{
$text = htmlspecialchars(trim($text), ENT_QUOTES);
if (1 === get_magic_quotes_gpc())
{
$text = stripslashes($text);
}
$text = nl2br($text);
return $text;
}
//Verifie le nom est correct uniquement des lettres
$motif_nom ='/^[a-z\d_]{3,12}$/i';
if(!preg_match($motif_nom,$_POST['nom']))
{
echo'<div id="dialog" title="Erreur">Votre nom est incorrect!!!!</div>';
include("footer.php");
return FALSE;
}
else{
$_POST['nom'];
}
//vérification de la premier adresse email puis le seconde
$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}$/';
if(!preg_match($motif_email,$_POST['email']))
{
echo'<div id="dialog" title="Erreur">La premier adresse email est incorrect!!!!</div>';
include("footer.php");
return FALSE;
}
else{
$_POST['email'];
}
$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_email_2,$_POST['email_2']))
{
echo'<div id="dialog" title="Erreur">La deuxième adresse email est incorrect!!!!</div>';
include("footer.php");
return FALSE;
}
else{
$_POST['email_2'];
}
$nom = (isset($_POST['nom'])) ? Rec($_POST['nom']) : '';
$email = (isset($_POST['email'])) ? Rec($_POST['email']) : '';
$email_2 = (isset($_POST['email_2'])) ? Rec($_POST['email_2']) : '';
$sexe = (isset($_POST['sexe'])) ? Rec($_POST['sexe']) : '';
$security = (isset($_POST['security_code']))? Rec($_POST['security_code']):'';
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("Y-m-d");
$quipass = date("Y-m-d");
$heure = date("H:i:s");
$heurepass = date("H:i:s");
////////////////////////////////////nouvel partie/////////////////////////////////////////////////////////////////////////////////////
if( isset($_POST['Submit'])) {
$inscr=0;
if($security == $_POST['security_code'] && !empty($security))
{
unset($_POST['security_code']);
echo' <script>
$(document).ready(function() {
$("#dialog").dialog({
modal: true,
opacity: 0.1,
minWidth: 400 ,
height: 120,
position: [500,250],
buttons: { "Ok": function() {
$(location).attr("href","inscription.php"); { $(this).dialog("close"); } } }
}); });
</script>';
echo'<div id="dialog" title="Erreur">Le code de sécurité n´est pas correct!!!!</div>';
include("footer.php");
$inscr=1;
return FALSE;
}
else
{
if (($nom != '') && ($email != '') && ($email_2!= '') && ($sexe != ''))
{
/////////////////////////////////////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)
{
echo' <script>
$(document).ready(function() {
$("#dialog").dialog({
modal: true,
opacity: .80,
minWidth: 400 ,
height: 120,
position: [450,250],
buttons: { "Ok": function() {
$(location).attr("href","index.php"); { $(this).dialog("close"); } } }
}); });
</script>';
echo'<div id="dialog" title="Erreur">Votre Nom est dans la base de donnée!!!!</div>';
include("footer.php");
$inscr=1;
return FALSE;
}
///////////////////////////////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)
{
echo' <script>
$(document).ready(function() {
$("#dialog").dialog({
modal: true,
opacity: .80,
minWidth: 400 ,
height: 120,
position: [450,250],
buttons: { "Ok": function() {
$(location).attr("href","inscription.php"); { $(this).dialog("close"); } } }
}); });
</script>';
echo'<div id="dialog" title="Erreur">Email est dans la base!!!!</div>';
include("footer.php");
$inscr=1;
return FALSE;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
$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);
if ($inscr==0){
@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)."',
'".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());
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());
//////////////////////////////////////////////////////////////////////////////////////////////////////
}
else
{
echo '<p>Erreur n° 1</p>';
}
}
else
{
echo '<p>Erreur n° 2</p>';
}
}
} // fin du if (!isset($_POST['submit']))
////////////////////////////////////////////////////////////////////////////////////////////////////// }
if(isset($_POST['Submit'])) {
echo'<table width="99%" height="308" border="0" />
<tr>
<td width="47%" height="304">
<form method="post" 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" value="'.stripslashes($nom).'" />
</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>';
}
?>