Check if the verfication code is right
<p>I try to implement php image verification code, here is in <code>test.php</code> file:</p>

<pre><code>&lt;form method="POST" action="processor.php"&gt;
  &lt;div style="float:left;"&gt;Code: &lt;input type="text" name="verif_box" style="cursor:text"&gt;     &lt;/div&gt; 
  &lt;div style="margin-top:0px;position:relative;left:5px;  top:-8px;"&gt;&lt;IMG SRC="image.php"&gt;&lt;/div&gt;
  &lt;input type="submit" name="submit" value="Submit"&gt;
&lt;/FORM&gt;
</code></pre>

<p>Here is <code>image.php</code>:</p>

<pre><code>   $width = 60;
      $height = 24;

 $my_image = imagecreatetruecolor($width, $height);

 imagefill($my_image, 0, 0, 0xFFFFFF);

   for ($c = 0; $c &lt; 110; $c++){
$x = rand(0,$width-1);
$y = rand(0,$height-1);
imagesetpixel($my_image, $x, $y, 0x000000);
}

$sessioncode=rand(0,9999);
  imagestring($my_image, 5, 0, 0, substr(strtoupper(md5("Mytext".$sessioncode)), 0,6),     $textcolor);
 setcookie('tntcon',(md5("Mytext".$sessioncode)));
imagejpeg($my_image);
imagedestroy($my_image);
     exit();
</code></pre>

<p>Here is <code>processor.php</code>:</p>

<pre><code>     $verif_box = $_POST["verif_box"];
 if (strtoupper($_COOKIE['tntcon']) == strtoupper($verif_box)) {
  echo "right code";
 } else {
   echo "wrong code";
    }
</code></pre>

<p>The problem is that, even I input the right verification code, in the processor.php file always give me "wrong code" message, what I am doing wrong?</p>
