voici un simple code clacul simple de captcha
fichier : contact.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 
<?php session_start(); 
$signes = array('+','*','/');
$nombre1 = rand(1,20);
$nombre2 = rand(10,50);
$lesigne = $signes[rand(0,2)];
$calcul = "$nombre1$lesigne$nombre2";
?>
<div id="zone_texte">
	<div id="titre_rubrique"><h1>Contact</h1></div>
  <h2 style=" margin:5px auto; padding:5px 0px"></h2>
 
 
    <div style="width:470px; float:right; margin-bottom:30px !important; overflow:hidden; border-left:1px dashed #a5a5a5"><FORM action="contact2.php" method="POST" enctype="multipart/form-data" name="contact">
      <table id="contacttab">
          <tr>
            <td align="right"> <label for="f1-nom">Nom:</label></td>
            <td><input name="f1-nom" type="text" id="f1-nom" /></td>
            </tr>
          <tr>
            <td align="right"><label for="f1-prenom">Prénom:</label> </td>
            <td><input name="f1-prenom" type="text" id="f1-prenom" /></td> 
            </tr>
          <tr>
            <td align="right"><label for="f1-adresse">Adresse:
              <span class="info">(Numéro et rue)</span></label> 
              :</td>
            <td><input name="f1-adresse" type="text" id="f1-adresse" /> </td>
            </tr>
          <tr>
            <td align="right"><label for="f1-ville">E-mail:
              <span class="info">(adresse électronique)</span></label> 
              :</td>
            <td><input name="f1-mail" type="text" id="f1-mail" /> </td>
            </tr>
          <tr>
            <td align="right"><label for="f1-telephone">Téléphone:</label> </td>
            <td><input name="f1-telephone" type="text" id="f1-telephone" /> </td>
            </tr>
 
          <tr>
            <td align="right"><label for="f1-infos">Votre message:</label> </td>
            <td><textarea name="f1-infos" id="f1-infos" rows="5" cols="30" style="height:120px; width:280px"></textarea> </td>
            </tr>
 
		  <tr>
            <td align="right"><label for="f1-telephone"><?php echo $calcul; ?> = </label> </td>
            <td><input name="reponsecaptcha2" type="text" id="f1-telephone" /> </td>
            </tr>
 
 
          <tr>
            <td></td>
            <td> 
            <input id="searchdomaine" name="envoyer" type="submit" style="float:right; display:block; margin-right:70px; width:120px; border-color:#1ab2e8; padding:5px !important; height:30px !important;"   onClick="mail1()" value="Envoyer" title="Envoyer le formulaire" >
             </td>
            </tr>
          </table>
      </form>
fichier : contact2.php

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
32
33
34
35
36
37
38
39
 
<?php
 
session_start();
	if(isset($_POST['envoyer'])){
	if(isset($_POST['captchaResult']))
	{
		$_POST['captchaResult'] = strtolower($_POST['captchaResult']);
		$_SESSION['captchaResult'] = strtolower($_SESSION['captchaResult']);
	}
 
	if($_POST['captchaResult'] == $_SESSION['captchaResult']){
 
$to = "rydweb@gmail.com"; 
$subject = "reponse du blog";
 
$headers = "From: " . $_POST["f1-nom"]." ". $_POST["f1-prenom"]; 
$headers .= "<" . $_POST["f1-mail"] . ">\r\n"; 
$headers .= "Reply-To: " . $_POST["f1-mail"] . "\r\n"; 
$headers .= "Return-Path: " . $_POST["f1-mail"]; 
 
$message .= "Nom: " . $_POST["f1-nom"] . "\r\n";
$message .= "Prenom: " . $_POST["f1-prenom"] . "\r\n";
$message .= "Adresse: " . $_POST["f1-adresse"] . "\r\n";
$message .= "E-mail: " . $_POST["f1-mail"] . "\r\n";
$message .= "Societe: " . $_POST["f1-organisation"] . "\r\n";
$message .= "Telephone: " . $_POST["f1-telephone"] . "\r\n";
$message .= "Message: \r\n---------\r\n" . $_POST["f1-infos"] . "\r\n";
 
$ok=mail($to, $subject, $message, $headers); 
if ($ok) {
 
 
 
 
 
}
?>
<span>On vas  Traiter Votre demande . Merci</span>
le probleme qu'il n'affiche pas la page contact2.php
en meme si le captcha et faux , le message s'envoie ....

Merci