Ou peut être n'est elle pas créée...

Voilà le problème J'utilise ce script anti spam :
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
 
<?php
/***************************************************************/
/*                                                             */
/*                __        ____                               */
/*          ___  / /  ___  / __/__  __ _____________ ___       */
/*         / _ \/ _ \/ _ \_\ \/ _ \/ // / __/ __/ -_|_-<       */
/*        / .__/_//_/ .__/___/\___/\_,_/_/  \__/\__/___/       */
/*       /_/       /_/                                         */
/*                                                             */
/*                                                             */
/***************************************************************/
/*                                                             */
/*  Titre:
/*  Image anti spam V2
/*                                                             */
/*  Auteur: R@f
/*  Date édition: 08-09-2007   
/*                                                             */
/***************************************************************/
/*
 >> le contenu dans l'image sera dans $_SESSION['livreor']
 >> 4 caractères

 Si le script est enregistré dans le fichier: anti_spam.php
 on appèle l'image comme ceci:
 <img src="anti_spam.php?name=livreor&strlen=4" alt="anti-flood" />

 Si $spam représente l'entrée utilsateur, le test se fait comme ceci:
 if( $_SESSION['livreor'] != strtoupper( $spam ) )
// erreur ici
/***************************************************************/
 
 
session_start();
 
// type de flood
$name = $_GET['name'];
// nb de caractères
$strlen = (int) $_GET['strlen'];
 
// taille de l'image ( width )
$width = $strlen * 23 + 20;
$height = 60;
// taille de chaque zone de couleur
$widthColor = $width / 4;
 
// création
$img = imagecreatetruecolor( $width, $height );
// antialising, c'est plus bo! :-)
imageantialias( $img, 1 );
 
// chaine
$string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$chaine = '';
for( $i = 0; $i < $strlen; $i++ )
  $chaine .= $string[ mt_rand( 0, 35 ) ];
 
$_SESSION[ $name ] = $chaine;
 
// couleur de départ
$c1 = array( mt_rand( 200, 255), mt_rand( 200, 255), mt_rand( 200, 255) );
// couleur finale
$c2 = array( mt_rand( 70, 180), mt_rand( 70, 180), mt_rand( 70, 180) );
// pas pour chaque composante de couleur
$diffsColor = array( ( $c1[0] - $c2[0] ) / $widthColor, ( $c1[1] - $c2[1] ) / $widthColor, ( $c1[2] - $c2[2] ) / $widthColor );
 
$start = 0;
$end = $widthColor;
 
for( $j = 0; $j < 4; $j++ ) // boucle pour chacune des 4 zones
{
  $r = $j % 2 == 0 ? $c1[0] : $c2[0]; // composante r de d?part
  $v = $j % 2 == 0 ? $c1[1] : $c2[1]; // idem v
  $b = $j % 2 == 0 ? $c1[2] : $c2[2]; // idem b
 
  // création des lignes
  for( $i = $start; $i < $end; $i++ )
  {
    if( $j % 2 == 0 )
    {
      $r -= $diffsColor[0];
      $v -= $diffsColor[1];
      $b -= $diffsColor[2];
    }
    else
    {
      $r += $diffsColor[0];
      $v += $diffsColor[1];
      $b += $diffsColor[2];
    }
 
    $color = imagecolorallocate( $img, $r, $v, $b );
 
    imageline( $img, $i, 0, $i, $height, $color );
  }
 
  $start += $widthColor;
  $end += $widthColor;
}
 
$colorsChar = array( ); // on va mémoriser les couleurs des caractères
 
// caractères
for( $i = 0; $i < $strlen; $i++ )
{
  $colorsChar[$i] = imagecolorallocate( $img, mt_rand( 0, 120 ), mt_rand( 0, 120 ), mt_rand( 0, 120 ) );
  imagettftext( $img, mt_rand( 20, 25 ), mt_rand( -35, 35 ), 10 + $i * 23, 35, $colorsChar[$i], 'FFFTRADI.TTF', $chaine[ $i ] );
}
 
// quelques lignes qui embetent
for( $i = 0; $i < 10; $i++ )
{
  imageline( $img, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $colorsChar[mt_rand( 0, $strlen - 1 )] );
}
 
$noir = imagecolorallocate( $img, 0, 0, 0 );
 
// bordure
imageline( $img, 0, 0, $width, 0, $noir );
imageline( $img, 0, 0, 0, $height, $noir );
imageline( $img, $width - 1, 0, $width - 1, $height, $noir );
 
// header: image
header("Content-type: image/png");
imagepng( $img ); 
imagedestroy( $img );
?>
l'extrait de code du formulaire qui l'appelle pour générer l'image:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
<div class="spam_dessin">
				<img src="specifique/include_php/anti_spam.php?name=antispam&strlen=4" alt="anti-flood" />
				</div>
				<div class="spam">
				<label>Recopier ci-dessous le contenu du dessin *</label>				
				<input name="spam" id="spam" type="text" size="6" maxlength="6" />
				</div>
et l'extrait de code ( qui se trouve dans un include ) pour le controle (il y a en plus des 'echo' pour voir si les variables sont bien récupérer...):
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
 
echo $_SESSION['antispam'].'|'.$spam;
if( $_SESSION['antispam'] != strtoupper( $spam ) ){
$msg_verif=$msg_verif.'<p class="texte_avertissement">Attention, veuillez bien recopier le contenu du dessin dans le champ pr&eacute;vu &agrave; cet effet.</p>';
 }
et le lien vers la page : http://90plan.ovh.net/~idproducx/spip.php?page=contact
En haut, il y a l'affichage des 'echo'.

La variable de session est elle bien créée ?
Comment faire pour le savoir et surtout avez vous des idées pour faire fonction ce script ?(Qui marche sur un autre site)

Pour info : CMS > SPIP, Hébergement : OVH 90plan...

Merci de votre aide !