problème de session suite migration vers php5

Petit nouveau ! | 9 Messages

11 nov. 2008, 23:30

Bonjour,
Dans mon formulaire je réaffiches les données saisie par l'utilisateur en cas d'erreur de saisie du code captcha ça fonctionnait bien avec php4 mais plus depuis la migration du site vers php5.

voici le code (simplifié) que j'utilise :

Code : Tout sélectionner

session_start(); $_SESSION['nom'] = $nom ; ----------------------------------------------------- <td><input type="text" class="input-text" name="nom" id="nom" value="$nom"/></td> ------------------------------------------------------
Merci.

Avatar du membre
ViPHP
ViPHP | 3008 Messages

11 nov. 2008, 23:41

id="nom" value="$nom"
Il n'y aurait pas un souci de guillemets ? Met un cote un peu plus complet à ce niveau.

Petit nouveau ! | 9 Messages

12 nov. 2008, 00:04

bonsoir charabia
je joins plus de code :
il faut savoir que mon site utilise la syntaxe heredoc le contenu se trouve entre les bilises <<<EOD et EOD; (ce qui complique un peu les choses)
la page du formulaire :

Code : Tout sélectionner

<?php $cryptinstall="./crypt/cryptographp.fct.php"; include $cryptinstall; ?> <?php include("session.php"); ?> <?php $skin['titre'] = "Notre formulaire r&eacute;servation ou demande d'information au camping"; $skin['fil ariane'] = "Reservation"; $skin['description'] = "Formulaire de r&eacute;servation du camping. Contactez nous pour réserver un emplacement ou une location de mobil-home"; $skin['mots clés'] = "camping bretagne, camping erquy, camping c&ocirc;tes d'armor, Erquy, formulaire de r&eacute;servation, r&eacute;servation, location, emplacement, mobil-home, mobil-homes, mobilhomes, mobilhome, animaux "; $ma_date = date('d/m/Y', time()); $test03 = dsp_crypt(0,"changer le code de l'image"); $reservation = TRUE; $skin['contenu'] .= <<<EOD <p><strong>Demande d'information/de disponibilit&eacute;s au Camping LES ROCHES ***</strong></p> <form action="script-informations.php" method="post" id="location-emplacement" onsubmit="return check_valid_form(false);"> <table> <tr> <td colspan="2" class="non_imprimer"><a href="javascript:popupwindow1('condition-location.htm');" title="voir nos conditions de location"><strong>Lire les conditions de location</strong></a></td> <td colspan="2" style="font-size:10px;"><span class="rouge">*</span> champs obligatoires</td> </tr> <tr> <td height="23">&nbsp;</td> </tr> <tr> <td class="bold"><label for="nom">Nom</label><span class="rouge">*</span> :</td> <td><input type="text" class="input-text" name="nom" id="nom" value="$nom"/></td> <td class="bold"><label for="prenom">Pr&eacute;nom</label> <span class="rouge">*</span> :</td> <td><input type="text" class="input-text" name="prenom" id="prenom" value="$prenom"/></td> </tr> <tr> <td colspan="2" class="cache-cache" id="nom_invalide">Veuillez saisir votre nom</td> <td colspan="2" class="cache-cache" id="prenom_invalide">Veuillez saisir votre pr&eacute;nom</td> </tr> <tr> <td class="bold"><label for="adresse">Adresse</label><span class="rouge">*</span> :</td> <td><input type="text" class="input-text" name="adresse" id="adresse" value="$adresse"/></td> <td class="bold"><label for="code_postal">Code postal</label><span class="rouge">*</span> :</td> <td><input type="text" class="input-text" name="code_postal" id="code_postal" value="$code_postal"/></td> </tr> <tr> <td colspan="2" class="cache-cache" id="adresse_invalide">Veuillez saisir votre adresse</td> <td colspan="2" class="cache-cache" id="code_postal_invalide">Veuillez saisir votre code postal</td> </tr> <tr> <td class="bold"><label for="ville">Ville</label><span class="rouge">*</span> :</td> <td><input type="text" class="input-text" name="ville" id="ville" value="$ville"/></td> <td class="bold"><label for="pays">Pays :</label></td> <td> <select size="1" name="pays" class="input-text" id="pays" value="$pays"> <option value="France" selected="selected">France</option> <option value="Allemagne">Allemagne</option> <option value="Autriche">Autriche</option> <option value="Belgique">Belgique</option> <option value="Danemark">Danemark</option> <option value="Espagne">Espagne</option> <option value="Finlande">Finlande</option> <option value="Grande Bretagne">Grande Bretagne</option> <option value="Grèce">Grèce</option> <option value="Irlande">Irlande</option> <option value="Islande">Islande</option> <option value="Italie">Italie</option> <option value="Luxembourg">Luxembourg</option> <option value="Norvège">Norvège</option> <option value="Pays-Bas">Pays-Bas</option> <option value="Portugal">Portugal</option> <option value="Russie & Europe Est">Russie & Europe Est</option> <option value="Suède">Suède</option> <option value="Suisse">Suisse</option> <option value="Autres pays">Autres pays</option> </select> </td> </tr> <tr> <td colspan="2" class="cache-cache" id="ville_invalide">Veuillez saisir le nom de votre ville</td> <td colspan="2"></td> </tr> <tr> <td class="bold"><label for="telephone">T&eacute;l&eacute;phone</label> <span class="rouge">*</span> :</td> <td><input type="text" class="input-text" name="telephone" id="telephone" value="$telephone"/></td> <td class="bold"><label for="email">E-Mail</label><span class="rouge">*</span> :</td> <td><input type="text" class="input-text" name="email" id="mail" value="$email"/></td> </tr> <tr> <td colspan="2" class="cache-cache" id="telephone_invalide">Veuillez saisir votre numéro de t&eacute;l&eacute;phone</td> <td colspan="2" class="cache-cache" id="email_invalide">Votre E-Mail est invalide</td> </tr> </table> <p style="text-align:center;"><input type="radio" id="choix1" name="choix" value="location" checked="checked" onclick="mon_slide('location')" /> <strong><label for="choix1">Location(s)</label></strong> <input type="radio" id="choix2" name="choix" value="emplacement" {$checked_emplacement} onclick="mon_slide('emplacement')"/> <strong><label for="choix2">Emplacement(s)</label></strong></p> <div id="location" class="locations"> <div> <!-- formulaire pour les locations --> <table> <tr> <td class="bold"><label>Nombre d'adultes :</label></td> <td> <input type="text" class="input-text" title="Nombre d'adultes" name="nb_adultes_location" value="$nb_adultes_location"/> </td> </tr> <tr> <td class="bold"><label>Nombre d'enfant(s) :</label></td> <td> <input type="text" class="input-text" name="nb_enfants_location" value="$nb_enfants_location"/> </td> </tr> <tr> <td class="bold"><label>Age des enfants :</label></td> <td> <input type="text" class="input-text" name="age_enfants_location" value="$age_enfants_location"/> </td> </tr> <tr> <td class="bold"><label>Nombre de chiens :</label></td> <td> <input type="text" class="input-text" name="nb_chiens_location" value="$nb_chiens_location"/> </td> </tr> <tr> <td class="bold"><label>Date d'arriv&eacute;e :</label></td> <td> <input onclick="displayCalendar(this,'dd/mm/yyyy',this);" type="text" class="input-text" name="date_arrivee_location" value="$date_arrivee_location"/> </td> </tr> <tr> <td class="bold"><label>Date de d&eacute;part :</label></td> <td> <input onclick="displayCalendar(this,'dd/mm/yyyy',this);" type="text" class="input-text" name="date_depart_location" value="$date_depart_location"/> </td> </tr> <tr> <td class="bold">Type(s) de location(s)</td> <td><input type="checkbox" name="type_location_atlante" value="4-6 Personnes" {$checked_atlante}/><label> 4-6 Personnes</label> <input type="checkbox" name="type_location_bikini" value="2-4 Personnes" {$checked_bikini}/><label> 2-4 Personnes</label> <br/> <input type="checkbox" name="type_location_3_chambres" value="Le 3 chambres" {$checked_3chambres}/><label> Le 3 Chambres</label> <input type="checkbox" name="type_location_loft" value="Le Loft" {$checked_loft}/><label> Le Loft</label> </td> </tr> </table> </div> </div> <div style="display:none;" id="emplacement" class="emplacements"> <div> <!-- formulaire pour les emplacements --> <table> <tr> <td class="bold"><label>Nombre d'adultes :</label></td> <td> <input type="text" class="input-text" title="Nombre d'adultes" name="nb_adultes_emplacement" value="$nb_adultes_emplacement"/> </td> </tr> <tr> <td class="bold"><label>Nombre d'enfant(s) :</label></td> <td> <input type="text" class="input-text" name="nb_enfants_emplacement" value="$nb_enfants_emplacement"/> </td> </tr> <tr> <td class="bold"><label>Age des enfants :</label></td> <td> <input type="text" class="input-text" name="age_enfants_emplacement" value="$age_enfants_emplacement"/> </td> </tr> <tr> <td class="bold"><label>Nombre de chiens :</label></td> <td> <input type="text" class="input-text" name="nb_chiens_emplacement" value="$nb_chiens_emplacement"/> </td> </tr> <tr> <td class="bold"><label>Date d'arriv&eacute;e :</label></td> <td> <input onclick="displayCalendar(this,'dd/mm/yyyy',this);" type="text" class="input-text" name="date_arrivee_emplacement" value="$date_arrivee_emplacement"/> </td> </tr> <tr> <td class="bold"><label>Date de d&eacute;part :</label></td> <td><input onclick="displayCalendar(this,'dd/mm/yyyy',this);" type="text" class="input-text" name="date_depart_emplacement" value="$date_depart_emplacement"/></td> </tr> <tr> <td class="bold">Branchement &eacute;lectrique :</td> <td> <input type="radio" name="type_electricite" id="branchement-aucun" value="aucun" checked="checked" /> <label for="branchement-aucun">Aucun</label>&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="type_electricite" id="branchement-6" value="6" {$checked_6A}/> <label for="branchement-6">6A</label>&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="type_electricite" id="branchement-10" value="10" {$checked_10A}/> <label for="branchement-10">10A</label> </td> </tr> <tr> <td class="bold">Type(s) d'emplacement(s)</td> <td><input type="checkbox" name="type_emplacement_campingcar" value="campingcar" id="type_emplacement_campingcar" {$checked_campingcar}/> <label for="type_emplacement_campingcar">Camping-car</label> <input type="checkbox" name="type_emplacement_caravane" value="caravane" id="type_emplacement_caravane" {$checked_caravane}/> <label for="type_emplacement_caravane">Caravane</label> <input type="checkbox" name="type_emplacement_tente" value="tente" id="type_emplacement_tente" {$checked_tente}/> <label for="type_emplacement_tente">Tente</label> <div class="cache-cache" id="type_emplacement">Veuillez choisir un type d'emplacement</div> </td> </tr> </table> </div> </div> <input type="checkbox" name="contrat" value="Je souhaite reçevoir un contrat" {$checked_contrat}/> <label class="bold"> Je souhaite re&ccedil;evoir un contrat s'il y a des disponibilit&eacute;es</label> <p class="bold">Vous avez la parole ...<br/> <textarea rows="4" cols="1" style="width:473px" name="message" id="message">{$message}</textarea> </p> <fieldset id="captcha"> <legend>Vérification</legend> <p> Merci de recopier le code anti-spam de l'image<span class="rouge">*</span> :<br /> </p> <p> {$test03} <input type="text" name="code" /></p> </fieldset><br /> <p style="text-align:center;" id="envoyer"><input type="submit" name="submit" value="Envoyer" title="cliquer pour envoyer votre demande"/> <input type="reset" value="annuler ou recommencer" title="cliquer pour recommancer"/></p> <p style="font-size:10px;font-style:italic;">Les animaux doivent &ecirc;tre tatou&eacute;s ( munissez-vous de leur carnet de vaccination ). Attention, seules quelques locations acceuillent les animaux.</p> <hr/> <p class="accompte">Je vous fais parvenir ci-joint mon acompte repr&eacute;sentant 25% du montant total du s&eacute;jour + 7€ de frais de dossier non d&eacute;ductibles, soit un montant de <input type="text" style="width:50px;" name="montant_acompte" id="montant_acompte" /> &euro; .</p> <p class="accompte"> <strong>Par :</strong><br/> <input type="radio" name="type_acompte" value="cheque"/> Chèque <input type="radio" name="type_acompte" value="cheques vacances" /> Chèques vacances <input type="radio" name="type_acompte" value="mandat postal" /> Mandat postal <br /> <input type="radio" name="type_acompte" value="carte bancaire" /> carte bancaire N° <input size="6" name="els_1" disabled="disabled" maxlength="4" /> / <input size="6" name="els_2" disabled="disabled" maxlength="4" /> / <input size="6" name="els_3" disabled="disabled" maxlength="4" /> / <input size="6" name="els_4" disabled="disabled" maxlength="4" /> <br/>Expire le : <input size="2" name="els_5" disabled="disabled" maxlength="2" /> / <input size="2" name="els_6" disabled="disabled" maxlength="2" /> <br /> Cryptogramme au dos de la carte : <input size="3" name="els_7" disabled="disabled" maxlength="3" /> <span class="non_imprimer"><a href="javascript:popupwindow1('cryptogramme.htm');" title="les trois chiffres du cryptogramme"><strong>A propos du cryptogramme</strong></a></span> <br/><span class="cryptogramme" style="color:#ff0000;background-color:#inherit;font-size:10px;">Veuillez remplir les champs de CB après impression du document.</span> <br/><br/> <strong>Je d&eacute;clare avoir pris connaissance des <a href="javascript:popupwindow1('condition-location.htm');" title="voir nos conditions de location">conditions de location</a> et les accepte.</strong><br/> <br/> <strong>A</strong> <input size="20" name="lieu" /> <strong>le</strong> <input size="10" name="date" value="{$ma_date}" /><br/><br/> <strong>Signature</strong> <br/> </p> </form> <p style="text-align:center" class="non_imprimer"><a href="javascript:window.print()" title="imprimer le formulaire du camping">imprimer le formulaire de r&eacute;servation</a></p> <script type="text/javascript"> function mon_slide(test){ $('choix1').disabled = true; $('choix2').disabled = true; test = (test != "location" && test != "emplacement") ? "location" : test; if (test == 'location'){ if ($('location').style.display == 'none'){ Effect.toggle('emplacement','slide',{duration:1}); Effect.toggle('location','slide',{delay:1, duration:1}); } }else{ if ($('emplacement').style.display == 'none'){ Effect.toggle('location', 'slide' ,{duration:1}); Effect.toggle('emplacement', 'slide' ,{delay:1, duration:1}); } } window.setTimeout("radio_on()",2000); } mon_slide('{$choix}'); function radio_on(){ $('choix1').disabled = false; $('choix2').disabled = false; } </script> EOD; include("_template/template.inc.php"); ?>
le fichier session.php :

Code : Tout sélectionner

<?php $checked_atlante = checked_atlante(); $checked_bikini = checked_bikini(); $checked_3chambres = checked_3chambres(); $checked_loft = checked_loft(); $checked_contrat = checked_contrat(); $checked_emplacement = checked_emplacement(); $checked_6A = checked_6A(); $checked_10A = checked_10A(); $checked_campingcar = checked_campingcar(); $checked_caravane = checked_caravane(); $checked_tente = checked_tente(); $_SESSION['nom'] = $nom ; $_SESSION['prenom'] = $prenom ; $_SESSION['adresse'] = $adresse ; $_SESSION['code_postal'] = $code_postal ; $_SESSION['ville'] = $ville ; $_SESSION['telephone'] = $telephone ; $_SESSION['email'] = $email ; $_SESSION['message'] = $message ; $_SESSION['contrat'] = $contrat ; $_SESSION['choix'] = $choix ; $_SESSION['pays'] = $pays ; $_SESSION['nb_adultes_location'] = $nb_adultes_location ; $_SESSION['nb_enfants_location'] = $nb_enfants_location ; $_SESSION['age_enfants_location'] = $age_enfants_location ; $_SESSION['nb_chiens_location'] = $nb_chiens_location ; $_SESSION['date_arrivee_location'] = $date_arrivee_location ; $_SESSION['date_depart_location'] = $date_depart_location ; $_SESSION['type_location_atlante'] = $type_location_atlante ; $_SESSION['type_location_bikini'] = $type_location_bikini ; $_SESSION['type_location_3_chambres'] = $type_location_3_chambres ; $_SESSION['type_location_loft'] = $type_location_loft ; $_SESSION['nb_adultes_emplacement'] = $nb_adultes_emplacement ; $_SESSION['nb_enfants_emplacement'] = $nb_enfants_emplacement ; $_SESSION['age_enfants_emplacement'] = $age_enfants_emplacement ; $_SESSION['nb_chiens_emplacement'] = $nb_chiens_emplacement ; $_SESSION['date_arrivee_emplacement'] = $date_arrivee_emplacement ; $_SESSION['date_depart_emplacement'] = $date_depart_emplacement ; $_SESSION['type_electricite'] = $type_electricite ; $_SESSION['type_emplacement_campingcar'] = $type_emplacement_campingcar ; $_SESSION['type_emplacement_caravane'] = $type_emplacement_caravane ; $_SESSION['type_emplacement_tente'] = $type_emplacement_tente ; function checked_atlante() { // Affiche checked $sid = SID; if(isset($_SESSION['type_location_atlante']) && ($_SESSION['type_location_atlante']) =="4-6 Personnes") { $str = <<<CHAINE checked="checked" CHAINE; } $str .= <<<CHAINE CHAINE; return $str; } ?> <?php function checked_bikini() { // Affiche checked $sid = SID; if(isset($_SESSION['type_location_bikini']) && ($_SESSION['type_location_bikini']) =="2-4 Personnes") { $str = <<<CHAINE checked="checked" CHAINE; } $str .= <<<CHAINE CHAINE; return $str; } ?> <?php function checked_3chambres() { // Affiche checked $sid = SID; if(isset($_SESSION['type_location_3_chambres']) && ($_SESSION['type_location_3_chambres']) =="Le 3 chambres") { $str = <<<CHAINE checked="checked" CHAINE; } $str .= <<<CHAINE CHAINE; return $str; } ?> <?php function checked_loft() { // Affiche checked $sid = SID; if(isset($_SESSION['type_location_loft']) && ($_SESSION['type_location_loft']) =="Le Loft") { $str = <<<CHAINE checked="checked" CHAINE; } $str .= <<<CHAINE CHAINE; return $str; } ?> <?php function checked_contrat() { // Affiche checked $sid = SID; if(isset($_SESSION['contrat']) && ($_SESSION['contrat']) =="Je souhaite reçevoir un contrat") { $str = <<<CHAINE checked="checked" CHAINE; } $str .= <<<CHAINE CHAINE; return $str; } ?> <?php function checked_emplacement() { // Affiche checked $sid = SID; if(isset($_SESSION['choix']) && ($_SESSION['choix']) =="emplacement") { $str = <<<CHAINE checked="checked" CHAINE; } $str .= <<<CHAINE CHAINE; return $str; } ?> <?php function checked_6A() { // Affiche checked $sid = SID; if(isset($_SESSION['type_electricite']) && ($_SESSION['type_electricite']) =="6") { $str = <<<CHAINE checked="checked" CHAINE; } $str .= <<<CHAINE CHAINE; return $str; } ?> <?php function checked_10A() { // Affiche checked $sid = SID; if(isset($_SESSION['type_electricite']) && ($_SESSION['type_electricite']) =="10") { $str = <<<CHAINE checked="checked" CHAINE; } $str .= <<<CHAINE CHAINE; return $str; } ?> <?php function checked_campingcar() { // Affiche checked $sid = SID; if(isset($_SESSION['type_emplacement_campingcar']) && ($_SESSION['type_emplacement_campingcar']) =="campingcar") { $str = <<<CHAINE checked="checked" CHAINE; } $str .= <<<CHAINE CHAINE; return $str; } ?> <?php function checked_caravane() { // Affiche checked $sid = SID; if(isset($_SESSION['type_emplacement_caravane']) && ($_SESSION['type_emplacement_caravane']) =="caravane") { $str = <<<CHAINE checked="checked" CHAINE; } $str .= <<<CHAINE CHAINE; return $str; } ?> <?php function checked_tente() { // Affiche checked $sid = SID; if(isset($_SESSION['type_emplacement_tente']) && ($_SESSION['type_emplacement_tente']) =="tente") { $str = <<<CHAINE checked="checked" CHAINE; } $str .= <<<CHAINE CHAINE; return $str; } ?>
le fichier d'envoi du formulaire :

Code : Tout sélectionner

<?php $cryptinstall="./crypt/cryptographp.fct.php"; include $cryptinstall; ?> <?php $nom = addslashes(htmlspecialchars($_POST['nom'])); $prenom = addslashes(htmlspecialchars($_POST['prenom'])); $adresse = addslashes(htmlspecialchars($_POST['adresse'])); $code_postal = addslashes(htmlspecialchars($_POST['code_postal'])); $ville = addslashes(htmlspecialchars($_POST['ville'])); $pays = addslashes(htmlspecialchars($_POST['pays'])); $telephone = addslashes(htmlspecialchars($_POST['telephone'])); $email = addslashes(htmlspecialchars($_POST['email'])); $choix = addslashes(htmlspecialchars($_POST['choix'])); $contrat = addslashes(htmlspecialchars($_POST['contrat'])); $msg = " <p>Bonjour, </p> <p>Vous avez re&ccedil;u une demande pour des <strong>".$choix."s</strong></p> <p><strong>nom : </strong>".stripslashes(htmlspecialchars($nom))."<br/> <strong>pr&eacute;nom : </strong>".stripslashes($prenom)."<br/> <strong>adresse : </strong>".stripslashes($adresse)."<br/> <strong>code postal : </strong>".stripslashes($code_postal)."<br/> <strong>ville : </strong>".stripslashes($ville)."<br/> <strong>pays : </strong>".stripslashes($pays)."<br/> <strong>telephone : </strong>".stripslashes($telephone)."<br/> <strong>email : </strong>".stripslashes($email)."<br/> <strong>contrat : </strong>".stripslashes($contrat)."</p>"; if ($choix == location){ $nb_adultes_location = addslashes(htmlspecialchars($_POST['nb_adultes_location'])); $nb_enfants_location = addslashes(htmlspecialchars($_POST['nb_enfants_location'])); $age_enfants_location = addslashes(htmlspecialchars($_POST['age_enfants_location'])); $nb_chiens_location = addslashes(htmlspecialchars($_POST['nb_chiens_location'])); $date_arrivee_location = addslashes(htmlspecialchars($_POST['date_arrivee_location'])); $date_depart_location = addslashes(htmlspecialchars($_POST['date_depart_location'])); $type_location_atlante = addslashes(htmlspecialchars($_POST['type_location_atlante'])); $type_location_bikini = addslashes(htmlspecialchars($_POST['type_location_bikini'])); $type_location_3_chambres = addslashes(htmlspecialchars($_POST['type_location_3_chambres'])); $type_location_loft = addslashes(htmlspecialchars($_POST['type_location_loft'])); $msg .= " <p><strong>nombre d'adultes : </strong>".stripslashes($nb_adultes_location)."<br/> <strong>nombre d'enfants : </strong>".stripslashes($nb_enfants_location)."<br/> <strong>age des enfants : </strong>".stripslashes($age_enfants_location)."<br/> <strong>nombre de chiens : </strong>".stripslashes($nb_chiens_location)."<br/> <strong>date d'arriv&eacute;e : </strong>".stripslashes($date_arrivee_location)."<br/> <strong>date de d&eacute;part : </strong>".stripslashes($date_depart_location)."<br/> <strong>type de location : </strong>".stripslashes($type_location_atlante)."".stripslashes($type_location_bikini)."".stripslashes($type_location_3_chambres)."".stripslashes($type_location_loft)."</p>"; } else{ //sinon $choix == emplacement $nb_adultes_emplacement = addslashes(htmlspecialchars($_POST['nb_adultes_emplacement'])); $nb_enfants_emplacement = addslashes(htmlspecialchars($_POST['nb_enfants_emplacement'])); $age_enfants_emplacement = addslashes(htmlspecialchars($_POST['age_enfants_emplacement'])); $nb_chiens_emplacement = addslashes(htmlspecialchars($_POST['nb_chiens_emplacement'])); $date_arrivee_emplacement = addslashes(htmlspecialchars($_POST['date_arrivee_emplacement'])); $date_depart_emplacement = addslashes(htmlspecialchars($_POST['date_depart_emplacement'])); $type_electricite = addslashes(htmlspecialchars($_POST['type_electricite'])); $type_emplacement_campingcar = addslashes(htmlspecialchars($_POST['type_emplacement_campingcar'])); $type_emplacement_caravane = addslashes(htmlspecialchars($_POST['type_emplacement_caravane'])); $type_emplacement_tente = addslashes(htmlspecialchars($_POST['type_emplacement_tente'])); $msg .= " <p><strong>nombre d'adultes : </strong>".stripslashes($nb_adultes_emplacement)."<br/> <strong>nombre d'enfants : </strong>".stripslashes($nb_enfants_emplacement)."<br/> <strong>age des enfants : </strong>".stripslashes($age_enfants_emplacement)."<br/> <strong>nombre de chiens : </strong>".stripslashes($nb_chiens_emplacement)."<br/> <strong>date d'arrivée : </strong>".stripslashes($date_arrivee_emplacement)."<br/> <strong>date de départ : </strong>".stripslashes($date_depart_emplacement)."<br/> <strong>électricité; : </strong>".stripslashes($type_electricite)."<br/> <strong>Type d'emplacement : </strong>".stripslashes($type_emplacement_campingcar)."".stripslashes($type_emplacement_caravane)."".stripslashes($type_emplacement_tente)."</p>"; } $message = addslashes(htmlspecialchars($_POST['message'])); $type_acompte = addslashes(htmlspecialchars($_POST['type_acompte'])); $montant_acompte = addslashes(htmlspecialchars($_POST['montant_acompte'])); $lieu = addslashes(htmlspecialchars($_POST['lieu'])); $date = addslashes(htmlspecialchars($_POST['date'])); $msg .= "<p><strong>message : </strong>".stripslashes($message)."</p> <p><strong>fait le : </strong>".stripslashes($date)."</p>"; ?> <html> <?php /****************************/ /***** Envoi des mails ******/ /****************************/ // envoi du mail if (chk_crypt($_POST['code'])) { $recipient = stripslashes("------"); $subject = "demande pour des ".$choix."s"; $mailheaders = "MIME-Version: 1.0 \n"; $mailheaders .= "Content-type: text/html; charset=utf-8 \n"; $mailheaders .= "From: ".$nom."-".$prenom." \n"; $mailheaders .="Content-Transfer-Encoding: 8bit \n"; $mailheaders .= "Reply-To: $email"; mail($recipient, $subject, $msg, $mailheaders); ?> <script type="text/javascript"> document.location.href="http://www.camping-les-roches.com/confirmation.php" </script> <?php } else { ?> <script type="text/javascript"> alert("code image faux, merci de recommencer"); document.location.href="http://www.camping-les-roches.com/reservation.php" </script> <?php } ?> </html>

Avatar du membre
ViPHP
ViPHP | 3008 Messages

12 nov. 2008, 00:12

Je ne vois pas le session_start(); dans les 3 bouts de code fournis c'est normal ?

Petit nouveau ! | 9 Messages

12 nov. 2008, 00:24

session_start() est dans le fichier cryptographp.fct.php qui est en include il sert au captcha.
c'est un scripte qui vient du site http://www.captcha.fr/
voir son contenu :

Code : Tout sélectionner

<?php // ----------------------------------------------- // Cryptographp v1.4 // (c) 2006-2007 Sylvain BRISON // // www.cryptographp.com // [email protected] // // Licence CeCILL modifiée // => Voir fichier Licence_CeCILL_V2-fr.txt) // ----------------------------------------------- if(session_id() == "") session_start(); $_SESSION['cryptdir']= dirname($cryptinstall); function dsp_crypt($cfg=0,$reload=1) { // Affiche le cryptogramme $sid = SID; $str = <<<CHAINE <img id='cryptogram' src='{$_SESSION['cryptdir']}/cryptographp.php?cfg={$cfg}&{$sid}'> CHAINE; if ($reload) { $title = ($reload != 1) ? $reload : null; $str .= <<<CHAINE <a title="{$title}" style="cursor:pointer" onclick="javascript:document.images.cryptogram.src='{$_SESSION['cryptdir']}/cryptographp.php?cfg={$cfg}&{$sid}&'+ Math.round(Math.random(0)*1000)+1"><img src="{$_SESSION['cryptdir']}/images/reload.png"></a> CHAINE; } $str .= <<<CHAINE CHAINE; return $str; } function chk_crypt($code) { // Vérifie si le code est correct include ($_SESSION['configfile']); $code = addslashes ($code); $code = str_replace(' ','',$code); // supprime les espaces saisis par erreur. $code = ($difuplow?$code:strtoupper($code)); switch (strtoupper($cryptsecure)) { case "MD5" : $code = md5($code); break; case "SHA1" : $code = sha1($code); break; } if ($_SESSION['cryptcode'] and ($_SESSION['cryptcode'] == $code)) { unset($_SESSION['cryptreload']); if ($cryptoneuse) unset($_SESSION['cryptcode']); return true; } else { $_SESSION['cryptreload']= true; return false; } } ?>

Avatar du membre
ViPHP
ViPHP | 3008 Messages

12 nov. 2008, 10:32

Si tu fais $_SESSION['nom'] = $nom; dans ta page formulaire tu dois utiliser $_SESSION['nom'] et non $nom si tu veux que ce soit pris en compte.

Petit nouveau ! | 9 Messages

13 nov. 2008, 14:36

j'ai mis $_SESSION['nom'] dans le formulaire (en effet c'est plus logique) mais ça n'a pas fonctionné.
J'ai ensuite déclarer $_SESSION['nom'] = $nom; dans le fichier d'envoi du formulaire et là ça fonctonne :)
Si tu as une explication ça m'intéresse qu'en même, je préférerais avoir mes variables de session dans le même fichier (sesson.php).

Merci.