obrazek.php
<?php $slowo= $_SESSION['token'];// dane z sesji $width=60; $height=25; $img=ImageCreate($width,$height); $bialy=ImageColorAllocate($img,255,255,255); $czarny=ImageColorAllocate($img,0,0,0); $szary=ImageColorAllocate($img,220, 220, 220); ImageFill($img,1,1,$bialy); for($i=0;$i<200;$i++) { ImageLine($img,$los1,$los2,$los1,$los2,$szary); } for($i=0;$i<strlen($slowo) ;$i++) { } ImageGIF($img); ?>
sprawdz.php
<?php $token = $_POST['toki']; $token2 = $_SESSION['token']; function nowykod() { $dlugosc_hasla = 4; $zestaw_znakow = "abcdefghijkmnpqrstuvwxyz23456789"; { } return $kod; } $kod= nowykod(); $_SESSION['token'] = $kod; { $error=1; $errortoken = "Przepsz kod z obrazka"; } if ($token != $token2){ $error=1; $errortoken = "Przepisz kod poprawnie"; } <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>'; echo '</table> <br /> <input type="submit" name="sprawdz" value="zmień dane" /> </fieldset> </form> ?>
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?