Mógłby mi ktoś wytłumaczyć dlaczego nie działa porównanie obrazków?

obrazek.php

  1. <?php
  2. $slowo= $_SESSION['token'];// dane z sesji
  3. $width=60;
  4. $height=25;
  5.  
  6.  
  7. $img=ImageCreate($width,$height);
  8. $bialy=ImageColorAllocate($img,255,255,255);
  9. $czarny=ImageColorAllocate($img,0,0,0);
  10. $szary=ImageColorAllocate($img,220, 220, 220);
  11.  
  12. ImageFill($img,1,1,$bialy);
  13. for($i=0;$i<200;$i++)
  14. {
  15. $los1=rand(0,$width);
  16. $los2=rand(0,$height);
  17.  
  18. ImageLine($img,$los1,$los2,$los1,$los2,$szary);
  19. }
  20. for($i=0;$i<strlen($slowo) ;$i++)
  21. {
  22. $rozmiar=rand(7,7);
  23.  
  24. ImageString($img,$rozmiar,$i*10+10,3,trim($slowo[$i]),$czarny);
  25. }
  26. Header("Content-type: image/png");
  27. ImageGIF($img);
  28. ?>



sprawdz.php

  1. <?php
  2. $token = $_POST['toki']; 
  3. $token2 = $_SESSION['token']; 
  4.  
  5. function nowykod()
  6. {
  7. $dlugosc_hasla = 4;
  8. $zestaw_znakow = "abcdefghijkmnpqrstuvwxyz23456789";
  9. srand((double)microtime() * 1000000);
  10.  
  11. while(strlen($kod) < $dlugosc_hasla)
  12. {
  13. $znak = $zestaw_znakow[rand(0, strlen($zestaw_znakow) - 1)];
  14. if(!is_integer(strpos($kod, $znak))) $kod .= $znak;
  15. }
  16. return $kod;
  17. }
  18. $kod= nowykod();
  19. $_SESSION['token'] = $kod;
  20.  
  21.  
  22. if (isset($_POST['sprawdz']))
  23. { 
  24.  
  25. if (empty($token)) { 
  26. $error=1; 
  27. $errortoken = "Przepsz kod z obrazka"; 
  28. }
  29.  
  30. if ($token != $token2){
  31. $error=1; 
  32. $errortoken = "Przepisz kod poprawnie";
  33.  
  34. }
  35.  
  36.  
  37. echo '<form action="sprawdz.php" method="post">';
  38. echo '<fieldset>';
  39. echo '<table class="tabele">';
  40. <td class="tabele9"> Token: </td><td class="tabele9"> <img src="obrazek.php" alt="" /> </td><td class="tabele6"> <input id="token" type="text" name="toki" maxlength="4" /> '.$errortoken.'</td></tr>';
  41.  
  42. echo '</table>
  43.  
  44. <br />
  45. <input type="submit" name="sprawdz" value="zmień dane" />
  46.  
  47. </fieldset>
  48. </form>
  49. ?>


I teraz najlepsze, pod linux działa bez problemu nawet po emulowanym IE6, chciałem przetestować to na localu pod XP więc zainstalowałem Webserver, jedychych róznic jakich się dopatrzyłem to Virtual Directory Support: enabled na windows, to ma jakieś znaczenie?