Bonjour à tous,
J'ai besoin d'un coup de pouce S.V.P.
Lorsque j'envoi mon formulaire j'ai une erreur qui me dis impossible d'envoyer le formulaire.
http://www.la-petite-reine-de-sion.net/inscription.php
voici le code:
[php]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>inscription</title></head><body style="border-style: groove; border-width: 0.3cm; background-color: rgb(255, 255, 255); background-repeat: no-repeat; width: 1500px; height: 900px; color: rgb(0, 0, 0); background-position: center bottom; background-image: url(images/Pages-web/comunicati.jpg); margin-right: auto; margin-left: auto; margin-top: 30px;" alink="#000088" link="black" vlink="black"><br>
<br>
<div style="margin-left: 40px; font-family: "Times New Roman",Times,serif; font-size: 18px;"><a href="Big%20Sorties.html">Retour</a><br>
<br>
<div style="text-align: center; font-family: "Times New Roman",Times,serif; font-size: 75px;">Inscription<br>
<br>
</div>
<table style="text-align: left; width: 600px; background-color: rgb(102, 204, 204); height: 500px; margin-left: auto; margin-right: auto;" border="4" cellpadding="3" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top; font-family: "Times New Roman",Times,serif; font-size: 15px;">
<?php
// On vérifie si la fonction ini_set() a été désactivée...
$desactive = ini_get('disable_functions');
if (preg_match("/ini_set/i", "$desactive") == 0) {
// Si elle n'est pas désactivée, on définit ini_set de manière à n'afficher que les erreurs...
ini_set("error_reporting" , "E_ALL & ~E_NOTICE");
}
// Vérifier que le formulaire a été envoyé...
if (isset($_POST['envoi'])) {
// Définir l'indicateur d'erreur sur zéro...
$flag_erreur = 0;
//On commence une session pour enregistrer les variables du formulaire...
session_start();
//Enregistrement du champ 1 - Type : liste
$_SESSION['champ1'] = stripslashes($_POST['champ1']);
//Validation PHP du champ 1...
if ($_POST['champ1'] == "" AND $flag_erreur != 1 ) {
$erreur = "Sortie ?";
$flag_erreur = 1;
$error_class_1 = "liste-error";
} // Fin du if...
//Enregistrement du champ 2 - Type : champ
$_SESSION['champ2'] = stripslashes($_POST['champ2']);
//Contrôle du spam...
if (preg_match("/http/i",$_POST['champ2'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter les caractères <b>http</b>";
$flag_erreur = 1;
}
if (preg_match("/[url/i",$_POST['champ2'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter les caractères <B>[url</b>";
$flag_erreur = 1;
}
if (preg_match("/<a/i",$_POST['champ2'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter des liens hypertexte.";
$flag_erreur = 1;
}
if (preg_match("/[link/",$_POST['champ2'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter les caractères <b>[link</b>";
$flag_erreur = 1;
}
//Validation PHP du champ 2...
$error_class_2 = "";
if ($_POST['champ2'] == "" AND $flag_erreur != 1 ) {
$erreur = "Nom- Prenom ?";
$flag_erreur = 1;
$error_class_2 = "input-error";
}// Fin du if...
//Enregistrement du champ 3 - Type : champ
$_SESSION['champ3'] = stripslashes($_POST['champ3']);
//Contrôle du spam...
if (preg_match("/http/i",$_POST['champ3'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter les caractères <b>http</b>";
$flag_erreur = 1;
}
if (preg_match("/[url/i",$_POST['champ3'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter les caractères <B>[url</b>";
$flag_erreur = 1;
}
if (preg_match("/<a/i",$_POST['champ3'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter des liens hypertexte.";
$flag_erreur = 1;
}
if (preg_match("/[link/",$_POST['champ3'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter les caractères <b>[link</b>";
$flag_erreur = 1;
}
//Validation PHP du champ 3...
$error_class_3 = "";
if ($_POST['champ3'] == "" AND $flag_erreur != 1 ) {
$erreur = "Accompagnants ?";
$flag_erreur = 1;
$error_class_3 = "input-error";
}// Fin du if...
//Enregistrement du champ 4 - Type : champ
$_SESSION['champ4'] = stripslashes($_POST['champ4']);
//Contrôle du spam...
if (preg_match("/http/i",$_POST['champ4'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter les caractères <b>http</b>";
$flag_erreur = 1;
}
if (preg_match("/[url/i",$_POST['champ4'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter les caractères <B>[url</b>";
$flag_erreur = 1;
}
if (preg_match("/<a/i",$_POST['champ4'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter des liens hypertexte.";
$flag_erreur = 1;
}
if (preg_match("/[link/",$_POST['champ4'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter les caractères <b>[link</b>";
$flag_erreur = 1;
}
//Validation PHP du champ 4...
$error_class_4 = "";
if ($_POST['champ4'] == "" AND $flag_erreur != 1 ) {
$erreur = "Adresse ?";
$flag_erreur = 1;
$error_class_4 = "input-error";
}// Fin du if...
//Enregistrement du champ 5 - Type : zone email
$_SESSION['champ5'] = stripslashes($_POST['champ5']);
//Contrôle du spam...
if (preg_match("/http/i",$_POST['champ5'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter les caractères <b>http</b>";
$flag_erreur = 1;
$error_class_5 = "input-error";
}
if (preg_match("/[url/i",$_POST['champ5'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter les caractères <B>[url</b>";
$flag_erreur = 1;
$error_class_5 = "input-error";
}
if (preg_match("/<a/i",$_POST['champ5'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter des liens hypertexte.";
$flag_erreur = 1;
$error_class_5 = "input-error";
}
if (preg_match("/[link/",$_POST['champ5'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter les caractères <b>[link</b>";
$flag_erreur = 1;
$error_class_5 = "input-error";
}
//Validation PHP du champ 5...
if ($_POST['champ5'] == "" AND $flag_erreur != 1 ) {
$erreur = "Mail ?";
$flag_erreur = 1;
$error_class_5 = "input-error";
} elseif (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i', $_POST['champ5']) AND $flag_erreur != 1) {
$erreur = "Adresse e-mail invalide. Veuillez vérifier...";
$flag_erreur = 1;
$error_class_5 = "input-error";
} // Fin du if...
//Enregistrement du champ 6 - Type : champ
$_SESSION['champ6'] = stripslashes($_POST['champ6']);
//Contrôle du spam...
if (preg_match("/http/i",$_POST['champ6'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter les caractères <b>http</b>";
$flag_erreur = 1;
}
if (preg_match("/[url/i",$_POST['champ6'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter les caractères <B>[url</b>";
$flag_erreur = 1;
}
if (preg_match("/<a/i",$_POST['champ6'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter des liens hypertexte.";
$flag_erreur = 1;
}
if (preg_match("/[link/",$_POST['champ6'])) {
$erreur = "Pour raisons de sécurité, ce champ ne peut comporter les caractères <b>[link</b>";
$flag_erreur = 1;
}
//Validation PHP du champ 6...
$error_class_6 = "";
if ($_POST['champ6'] == "" AND $flag_erreur != 1 ) {
$erreur = "Telephone ?";
$flag_erreur = 1;
$error_class_6 = "input-error";
}// Fin du if...
// Enregistrement du code Captcha...
if ( isset ($_POST['captcha']) AND isset ($_POST['code']) AND $flag_erreur != 1)
{
$captcha = $_POST['captcha'];
$code = $_POST['code'];
$code = $code / '318.5';
if ($captcha == NULL)
{
$erreur = "Vous n'avez pas saisi le code Captcha...";
$flag_erreur = 1;
}
elseif ($captcha != $code)
{
$erreur = "Le code Captcha saisi n'est pas correct...";
$flag_erreur = 1;
} else {
// Captcha is correct
$flag_erreur = 0;
}
}
// N'envoyer le formulaire que s'il n'y a pas d'erreurs...
if ($flag_erreur == 0) {
// Addresse de réception du formulaire
$email_dest = "
[email protected]";
$sujet = "Inscription Sortie";
$entetes ="MIME-Version: 1.0 \n";
$entetes .="From: La Petite Reine de Sion<
[email protected]>\n";
$entetes .="Return-Path: La Petite Reine de Sion<
[email protected]>\n";
$entetes .="Reply-To: La Petite Reine de Sion<
[email protected]>\n";
$entetes .="Content-Type: text/html; charset=utf-8 \n";
$partie_entete = "<html>\n<head>\n<title>Formulaire</title>\n<meta http-equiv=Content-Type content=text/html; charset=utf-8>\n</head>\n<body bgcolor=#FFFFFF>\n";
//Partie HTML de l'e-mail...
$partie_email_html .= "<font face=\"Verdana\" size=\"2\" color=\"#003366\">Sorties = " . $_SESSION['champ1'] . "</font><br>\n";
$partie_email_html .= "<font face=\"Verdana\" size=\"2\" color=\"#003366\">Nom-Prenom = " . $_SESSION['champ2'] . "</font><br>\n";
$partie_email_html .= "<font face=\"Verdana\" size=\"2\" color=\"#003366\">Nombre accompagnants = " . $_SESSION['champ3'] . "</font><br>\n";
$partie_email_html .= "<font face=\"Verdana\" size=\"2\" color=\"#003366\">Adresse = " . $_SESSION['champ4'] . "</font><br>\n";
$partie_email_html .= "<font face=\"Verdana\" size=\"2\" color=\"#003366\">Mail = " . $_SESSION['champ5'] . "</font><br>\n";
$partie_email_html .= "<font face=\"Verdana\" size=\"2\" color=\"#003366\">Telephone = " . $_SESSION['champ6'] . "</font><br>\n";
// Fin du message HTML
$fin = "</body></html>\n\n";
$sortie = $partie_entete . $partie_email_html . $fin;
// Send the e-mail
if (@!mail($email_dest,$sujet,$sortie,$entetes)) {
echo("Envoi du formulaire impossible");
exit();
} else {
// Rediriger vers la page de remerciement
header("Location:http://www.la-petite-reine-de-sion.net/merci.html");
exit();
} // Fin else
} // Fin du if ($flag_erreur == 0) {
} // Fin de if POST
// Créer image captcha
$code = rand('100000', '999999');
header("Expires: Wed, 1 Jan 1997 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header ('Content-type: image/png');
$image = imagecreate('56', '20');
$noir = imagecolorallocate($image, '0', '0', '0');
$blanc = imagecolorallocate($image, '255', '255', '255');
imagestring($image, '4', '4', '2', $code, $blanc);
imagepng($image, 'code.png');
imagedestroy($image);
$cache_killer = time();
header ('Content-type: text/html');
$code = $code * '318.5';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Formulaire Assistant Pro v2.0</title>
<style type="text/css">
body {
font-family:Verdana, Geneva, sans-serif;
font-size:12px;
background-color:#66CCCC;
}
form {
padding: 8px;
}
div {
border: 0px solid black;
}
fieldset {
width: 600px;
margin: 0 auto;
}
legend {
}
label {
text-align: right;
width: 160px;
height:20px;
float: left;
clear: left;
margin-right: 10px;
margin-top: 4px;
}
select {
width: 158px;
}
textarea {
font-family:Verdana, Geneva, sans-serif;
font-size:12px;
}
.radio-label {
display:inline;
}
.radio-input {
margin-top: 5px;
}
.case-input {
margin-top: 5px;
}
.case-label {
display:inline;
}
.submit {
margin-left:168px;
}
.error {
text-align:center;
margin: 8px;
padding: 3px;
display:none;
}
.error-displayed {
text-align:center;
visibility:visible;
margin: 8px;
padding: 3px;
border: 2px solid #DC6461;
color: white;
background-color:#C00;
display:block;
}
.input-error {
background-color:#FFD7D7;
}
.liste {
width: 142px;
}
.liste-error {
background-color:#FFD7D7;
width: 142px;
}
textarea-error {
font-family:Verdana, Geneva, sans-serif;
font-size:12px;
background-color:#FFD7D7;
}
.captcha-img {
position:relative;
top: 5px;
padding-top:0px;
margin-bottom: 0px;
padding-bottom: 0px;
line-height:20px;
}
.captcha-input {
position:relative;
top: 0px;
}
.captcha-error {
position:relative;
top: 0px;
background-color:#FFD7D7;
}
</style>
<script type="text/javascript" language="JavaScript">
<!--
//<![CDATA[
function verifSelection() {
if (document.formulaire.champ1.value == "") {
document.getElementById('error').innerHTML = "Sortie ?";
document.getElementById('error').className = "error-displayed";
document.getElementById('champ1').className = "liste-error";
return false;
} else {
document.getElementById('champ1').className = "liste";
} // Fin du else
if (document.formulaire.champ2.value == "") {
document.getElementById('error').innerHTML = "Nom- Prenom ?";
document.getElementById('error').className = "error-displayed";
document.getElementById('champ2').className = "input-error";
document.formulaire.champ2.focus();
return false;
} else {
document.getElementById('champ2').className = "";
}
if (document.formulaire.champ3.value == "") {
document.getElementById('error').innerHTML = "Accompagnants ?";
document.getElementById('error').className = "error-displayed";
document.getElementById('champ3').className = "input-error";
document.formulaire.champ3.focus();
return false;
} else {
document.getElementById('champ3').className = "";
}
if (document.formulaire.champ4.value == "") {
document.getElementById('error').innerHTML = "Adresse ?";
document.getElementById('error').className = "error-displayed";
document.getElementById('champ4').className = "input-error";
document.formulaire.champ4.focus();
return false;
} else {
document.getElementById('champ4').className = "";
}
if (document.formulaire.champ5.value == "") {
document.getElementById('error').innerHTML = "Mail ?";
document.getElementById('error').className = "error-displayed";
document.getElementById('champ5').className = "input-error";
document.formulaire.champ5.focus();
return false;
} else {
document.getElementById('champ5').className = "";
}
invalidChars = " /:,;'"
for (i=0; i < invalidChars.length; i++) { // does it contain any invalid characters?
badChar = invalidChars.charAt(i)
if (document.formulaire.champ5.value.indexOf(badChar,0) > -1) {
document.getElementById('error').innerHTML = "Votre adresse e-mail contient des caractères invalides. Veuillez vérifier.";
document.getElementById('error').className = "error-displayed";
document.getElementById('champ5').className = "input-error";
document.formulaire.champ5.focus();
return false;
} else {
document.getElementById('champ5').className = "";
} // Fin du else
} // Fin de la boucle for...
atPos = document.formulaire.champ5.value.indexOf("@",1) // there must be one "@" symbol
if (atPos == -1) {
document.getElementById('error').innerHTML = "Votre adresse e-mail ne contient pas le signe \"@\". Veuillez vérifier.";
document.getElementById('error').className = "error-displayed";
document.getElementById('champ5').className = "input-error";
document.formulaire.champ5.focus();
return false;
} else {
document.getElementById('champ5').className = "";
} // Fin du else
if (document.formulaire.champ5.value.indexOf("@",atPos+1) != -1) { // and only one "@" symbol
document.getElementById('error').innerHTML = "Il ne doit y avoir qu\'un signe \"@ \". Veuillez vérifier.";
document.getElementById('error').className = "error-displayed";
document.getElementById('champ5').className = "input-error";
document.formulaire.champ5.focus();
return false;
} else {
document.getElementById('champ5').className = "";
} // Fin du else
periodPos = document.formulaire.champ5.value.indexOf(".",atPos)
if (periodPos == -1) { // and at least one "." after the "@"
document.getElementById('error').innerHTML = "Vous avez oublié le point \". \" après le signe \"@\". Veuillez vérifier.";
document.getElementById('error').className = "error-displayed";
document.getElementById('champ5').className = "input-error";
document.formulaire.champ5.focus();
return false;
} else {
document.getElementById('champ5').className = "";
} // Fin du else
if (periodPos+3 > document.formulaire.champ5.value.length) { // must be at least 2 characters after the
document.getElementById('error').innerHTML = "Il doit y avoir au moins deux caractères après le signe \".\". Veuillez vérifier.";
document.getElementById('error').className = "error-displayed";
document.getElementById('champ5').className = "input-error";
document.formulaire.champ5.focus();
return false;
} else {
document.getElementById('champ5').className = "";
} // Fin du else
if (document.formulaire.champ6.value == "") {
document.getElementById('error').innerHTML = "Telephone ?";
document.getElementById('error').className = "error-displayed";
document.getElementById('champ6').className = "input-error";
document.formulaire.champ6.focus();
return false;
} else {
document.getElementById('champ6').className = "";
}
if (document.formulaire.captcha.value == "") {
document.getElementById('error').innerHTML = "Veuillez saisir le code de l'image...";
document.getElementById('error').className = "error-displayed";
document.getElementById('captcha').className = "captcha-error";
document.formulaire.captcha.focus();
return false;
} else {
document.getElementById('captcha').className = "captcha-input";
} // Fin du else
} // Fin de la fonction
//]]>
//-->
</script>
</head>
<body>
<form name="formulaire" method="post" action="<?php echo($_SERVER['SCRIPT_NAME']); ?>" onsubmit="return verifSelection()">
<fieldset>
<legend>Formulaire d'inscription</legend>
<?php
if ($flag_erreur == 1) {
echo("<div id=\"error\" class=\"error-displayed\">$erreur</div><br />");
} else {
echo("<div id=\"error\" class=\"error\"></div><br />");
}
?><div><label for="champ1">Sorties</label>
<select name="champ1" id="champ1" class="<?php echo($error_class_1); ?>" ><option value="">Sélectionner...</option>
<option value="Hohtenn 16 juin"<?php
if ($_SESSION['champ1'] == "Hohtenn 16 juin") {
echo(" selected");
}
?>>Hohtenn 16 juin</option>
<option value=" Vallée de Joux 11 Aout"<?php
if ($_SESSION['champ1'] == " Vallée de Joux 11 Aout") {
echo(" selected");
}
?>> Vallée de Joux 11 Aout</option>
<option value="Lavey-Morcle 25 Aout"<?php
if ($_SESSION['champ1'] == "Lavey-Morcle 25 Aout") {
echo(" selected");
}
?>>Lavey-Morcle 25 Aout</option>
<option value="Etoile du Valais 1 Septembre"<?php
if ($_SESSION['champ1'] == "Etoile du Valais 1 Septembre") {
echo(" selected");
}
?>>Etoile du Valais 1 Septembre</option>
<option value="Val d'Abondance 8 Septembre"<?php
if ($_SESSION['champ1'] == "Val d'Abondance 8 Septembre") {
echo(" selected");
}
?>>Val d'Abondance 8 Septembre</option>
<option value="Grande Dixence 22 Septembre"<?php
if ($_SESSION['champ1'] == "Grande Dixence 22 Septembre") {
echo(" selected");
}
?>>Grande Dixence 22 Septembre</option>
<option value="Rimini du 11 au 26 Mai"<?php
if ($_SESSION['champ1'] == "Rimini du 11 au 26 Mai") {
echo(" selected");
}
?>>Rimini du 11 au 26 Mai</option>
<option value="Tour du Mont Blanc du 8 au 12 Juillet"<?php
if ($_SESSION['champ1'] == "Tour du Mont Blanc du 8 au 12 Juillet") {
echo(" selected");
}
?>>Tour du Mont Blanc du 8 au 12 Juillet</option>
<option value="Assemblée Generale 11 Novembre"<?php
if ($_SESSION['champ1'] == "Assemblée Generale 11 Novembre") {
echo(" selected");
}
?>>Assemblée Generale 11 Novembre</option>
</select></div><br /><div><label for="champ2">Nom-Prenom</label>
<input name="champ2" id="champ2" type="text" value="<?php echo(stripslashes($_SESSION['champ2'])); ?>" class="<?php echo($error_class_2); ?>" /></div><br />
<div><label for="champ3">Nombre accompagnants</label>
<input name="champ3" id="champ3" type="text" value="<?php echo(stripslashes($_SESSION['champ3'])); ?>" class="<?php echo($error_class_3); ?>" /></div><br />
<div><label for="champ4">Adresse</label>
<input name="champ4" id="champ4" type="text" value="<?php echo(stripslashes($_SESSION['champ4'])); ?>" class="<?php echo($error_class_4); ?>" /></div><br />
<div><label for="champ5">Mail</label>
<input name="champ5" id="champ5" type="text" value="<?php echo(stripslashes($_SESSION['champ5'])); ?>" class="<?php echo($error_class_5); ?>" /></div><br />
<div><label for="champ6">Telephone</label>
<input name="champ6" id="champ6" type="text" value="<?php echo(stripslashes($_SESSION['champ6'])); ?>" class="<?php echo($error_class_6); ?>" /></div><br />
<div><label for="captcha">Saisir le code de l'image:</label>
<img src="<?php echo("code.png?".$cache_killer); ?>" title="Code" alt="Code" class="captcha-img"/>
<input type="text" name="captcha" id="captcha" class="captcha-input" size="8" maxlength="6" <?php echo($value); ?>/>
<input name="code" id="code" type="hidden" value="<?php echo($code); ?>"/></div><br /><div class="submit"><input type="reset" name="Reset" value="Effacer" />
<input type="submit" name="envoi" value="Envoyer" /></div></fieldset></form>
</body></html><br>
</td>
</tr>
</tbody>
</table>
</div></body></html>[/php]