Mógłby mi ktoś wytłumaczyć dlaczego nie działa porównanie obrazków?
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++)
{
ImageString
($img,$rozmiar,$i*10
+10
,3
,trim($slowo[$i]),$czarny); }
Header("Content-type: image/png"); ImageGIF($img);
?>
sprawdz.php
<?php
$token = $_POST['toki'];
$token2 = $_SESSION['token'];
function nowykod()
{
$dlugosc_hasla = 4;
$zestaw_znakow = "abcdefghijkmnpqrstuvwxyz23456789";
while(strlen($kod) < $dlugosc_hasla) {
$znak = $zestaw_znakow[rand(0
, strlen($zestaw_znakow) - 1
)]; }
return $kod;
}
$kod= nowykod();
$_SESSION['token'] = $kod;
if (isset($_POST['sprawdz'])) {
$error=1;
$errortoken = "Przepsz kod z obrazka";
}
if ($token != $token2){
$error=1;
$errortoken = "Przepisz kod poprawnie";
}
echo '<form action="sprawdz.php" method="post">'; echo '<table class="tabele">'; <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?
Ten post edytował !*! 20.08.2008, 19:00:32