Précédent   Forum des professionnels en informatique > PHP > Langage
Langage Forum sur le langage PHP, la POO, les conventions, la sécurité, etc. Avant de poster : FAQ Langage, toutes les FAQ PHP, cours langage et sources PHP
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 25/05/2011, 20h06   #1
 
Inscription : avril 2010
Messages : 123
Détails du profil
Informations forums :
Inscription : avril 2010
Messages : 123
Points : -8
Points : -8
Par défaut probleme dans captcha

Bonjour,

j'ai un formulaire contact dans mon site web, j'ai ajouté un script php pour la capatcha, un textbox pour entrer un code de verification.

tout fonctionne tres bien, mais quand je reçois un mail, je reçois ceci .

nom : xxxxx
mail : xxxxx
message : xxxxx

et encore
vercode : 345654 //ceci est le textbox du code de capatcha saisi lors de la compilation du form.

comment je fais pour ne pas afficher ce vercode dans les mails reçus?

merci.
windows2056 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2011, 20h51   #2
Membre régulier
 
Avatar de 2h15Crew
 
Homme Valentin
Étudiant
Inscription : mai 2011
Messages : 79
Détails du profil
Informations personnelles :
Nom : Homme Valentin
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 79
Points : 97
Points : 97
Peux-tu être plus clair s'il-te-plait ?
2h15Crew est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2011, 21h01   #3
 
Inscription : avril 2010
Messages : 123
Détails du profil
Informations forums :
Inscription : avril 2010
Messages : 123
Points : -8
Points : -8
Par défaut capatcha

j'ai un simple form de contact pour recevoir des mails des visiteurs de mon site web.

j'ai ajouter un script php du capatcha a mon form de contact, alors j'ai ajouter ce ligne de code :

Entra Codice : &nbsp;<img src="captcha.php"><br/><input type="text" name="vercode" /><br>

alors le code du form + capatcha fonctionne super bien.

le probleme c'est que quand un visiteur du site m'envoyer un mail, je reçois dans ce mail :

nom :
email :
message :

et aussi :
code : 345433 //est le code que le visiteur a saisi dans le textbox du capatcha mai mois je veux pas que ce code sera affiché dans l'email.

merci.
windows2056 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2011, 21h06   #4
Membre régulier
 
Avatar de 2h15Crew
 
Homme Valentin
Étudiant
Inscription : mai 2011
Messages : 79
Détails du profil
Informations personnelles :
Nom : Homme Valentin
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 79
Points : 97
Points : 97
C'est toi qui formate le mail a envoyer ? Si oui, il te suffit juste d'enlever le vercode du body du mail.
2h15Crew est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2011, 21h07   #5
 
Inscription : avril 2010
Messages : 123
Détails du profil
Informations forums :
Inscription : avril 2010
Messages : 123
Points : -8
Points : -8
Par défaut capatcha

merci pour ta reponse mais tu peux m'aider a localiser ce body car j'arrive pas a trouver ce code ?
windows2056 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2011, 21h09   #6
Membre régulier
 
Avatar de 2h15Crew
 
Homme Valentin
Étudiant
Inscription : mai 2011
Messages : 79
Détails du profil
Informations personnelles :
Nom : Homme Valentin
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 79
Points : 97
Points : 97
Si tu ne copies pas le code du script d'envoie de mail, je ne vais pas pouvoir t'aider...
2h15Crew est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2011, 21h15   #7
 
Inscription : avril 2010
Messages : 123
Détails du profil
Informations forums :
Inscription : avril 2010
Messages : 123
Points : -8
Points : -8
Par défaut capatcha

alors j'ai :

1 - page contact.html :

ce code pour ajouter le script du capatcha a la page contact.

Code :
Entra Codice : &nbsp;<img src="captcha.php"><br/><input type="text" name="vercode" /><br>
(la page contact a un form : nom, email, message + button submit)

2 - page capatcha.php :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php 
session_start(); 
$text = rand(10000,99999); 
$_SESSION["vercode"] = $text; 
$height = 25; 
$width = 60; 
 
$image_p = imagecreate($width, $height); 
$black = imagecolorallocate($image_p, 0, 0, 0); 
$white = imagecolorallocate($image_p, 255,255 ,255 ); 
$font_size = 14; 
 
imagestring($image_p, $font_size, 5, 5, $text, $white); 
imagejpeg($image_p, null, 80); 
?>
3 - page invia.php :

dans la page contact.html, il ya :
Code :
<form name="form1" id="form1" method="post" action="invia.php">
alors j'ai ajouté ce code a la page invia.php :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
<?php 
session_start(); 
if ($_POST["vercode"] != $_SESSION["vercode"] OR $_SESSION["vercode"]=='')  
{ 	
     echo  '<strong><center><font color="red">Codice di Verifica errato !!</font></center></strong><br><br><br>'; 
			 ?>
			 <center><a href="javascript:history.back(-1);">Indietro</a></center>
             <?			 
} 
else 
{ 
?>

c'est tout que j'ai changé apres l'ajout du script capatcha.
windows2056 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2011, 21h20   #8
Membre régulier
 
Avatar de 2h15Crew
 
Homme Valentin
Étudiant
Inscription : mai 2011
Messages : 79
Détails du profil
Informations personnelles :
Nom : Homme Valentin
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 79
Points : 97
Points : 97
Peux-tu poster le code de invia.php en entier ? N'oublie pas de le mettre entre des balises code pour que ça reste lisible...
2h15Crew est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2011, 21h25   #9
 
Inscription : avril 2010
Messages : 123
Détails du profil
Informations forums :
Inscription : avril 2010
Messages : 123
Points : -8
Points : -8
Par défaut capatcha

ok
windows2056 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2011, 21h30   #10
Membre régulier
 
Avatar de 2h15Crew
 
Homme Valentin
Étudiant
Inscription : mai 2011
Messages : 79
Détails du profil
Informations personnelles :
Nom : Homme Valentin
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 79
Points : 97
Points : 97
Code :
1
2
3
4
 
if($key!="Submit")
    $corpo .= "<b>".$key ."</b>: ". $valore ."<br>";
}
Dans cette partie du code essaye de modifier la condition de ton if pour mettre

Code :
1
2
3
4
 
if($key != "Submit" || $key != "vercode")
    $corpo .= "<b>".$key ."</b>: ". $valore ."<br>";
}
2h15Crew est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2011, 22h02   #11
 
Inscription : avril 2010
Messages : 123
Détails du profil
Informations forums :
Inscription : avril 2010
Messages : 123
Points : -8
Points : -8
Par défaut capatcha

j'ai modifié le code, quand j'ai faot un test, j'ai reçu ce mail :

Nome: asdsd
Messaggio: sdsdssdsd
Cognome: sdsd
Azienda: sdsd
Telefono: sdsdsd
E-mail: sdsds
Vercode: 96555

alors je veux pas afficher vercode .
windows2056 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2011, 22h04   #12
Membre régulier
 
Avatar de 2h15Crew
 
Homme Valentin
Étudiant
Inscription : mai 2011
Messages : 79
Détails du profil
Informations personnelles :
Nom : Homme Valentin
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 79
Points : 97
Points : 97
Peux-tu copier le code de ton formulaire ?
2h15Crew est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2011, 22h11   #13
 
Inscription : avril 2010
Messages : 123
Détails du profil
Informations forums :
Inscription : avril 2010
Messages : 123
Points : -8
Points : -8
Par défaut capatcha

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<form name="form1" id="form1" method="post" action="invia.php">
			  <table border="0">
                <tr valign="top">
                  <td><p class="testo3">Nome:<br /><input name="nome" type="text" id="nome" size="20" /></td>
                  <td rowspan="5"><p class="testo3">Messaggio:<br />
                  <textarea name="messaggio" cols="20" rows="13" id="messaggio"></textarea></td>               
                </tr>
                <tr>
                  <td><p class="testo3">Cognome:<br /><input name="cognome" type="text" id="cognome" size="20" /></td>
                </tr>
                <tr>
                  <td><p class="testo3">Azienda:<br /><input name="azienda" type="text" id="cognome" size="20" /></td>
                </tr>                
                <tr>
                  <td><p class="testo3">Telefono:<br /><input name="telefono" type="text" id="telefono" size="20" /></td>
                </tr>
                <tr>
                  <td><p class="testo3">E-mail:<br /><input name="e-mail" type="text" id="e-mail" size="20" /></td>
                </tr>
                <tr>
                  <td colspan="2"><p class="testo3"><br>
				  Entra Codice : &nbsp;<img src="captcha.php"><br/><input type="text" name="vercode" /><br> 
				  <br />
  </td>
                </tr>    
                 <tr>
                  <td colspan="2"><input type="submit" name="Submit" value="Invia" />
                  <input type="reset" name="Submit2" value="Cancella" /></td>
                </tr>                           
              </table>
			  </form>
windows2056 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2011, 22h15   #14
Membre régulier
 
Avatar de 2h15Crew
 
Homme Valentin
Étudiant
Inscription : mai 2011
Messages : 79
Détails du profil
Informations personnelles :
Nom : Homme Valentin
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 79
Points : 97
Points : 97
Fais un test pour afficher les valeurs que prend $key dans ton foreach et affiche les ici =)
2h15Crew est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/05/2011, 22h34   #15
 
Inscription : avril 2010
Messages : 123
Détails du profil
Informations forums :
Inscription : avril 2010
Messages : 123
Points : -8
Points : -8
Par défaut capatcha

mais comment je fais ce test, vraiment je sais pas
windows2056 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/05/2011, 14h50   #16
Membre régulier
 
Avatar de 2h15Crew
 
Homme Valentin
Étudiant
Inscription : mai 2011
Messages : 79
Détails du profil
Informations personnelles :
Nom : Homme Valentin
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 79
Points : 97
Points : 97
Avec des echo
2h15Crew est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 15h41.


 
 
 
 
Partenaires

Hébergement Web