Ja używam takiego prostego tokena
Kod generujący:
<?
function passgen() {
$b = $nr - $a;
for($i = 0; $i < strlen($a); $i++) $pass .= $a[$i].$b[$i]; return $pass;
}
header("Content-type: image/png"); $img = imagecreate(140, 30);
$background = imagecolorallocate($img, 255, 255, 255);
$textcolor = imagecolorallocate($img, 65, 162, 223);
imagestring($img, 5, 10, 7, passgen(), $textcolor);
imagejpeg($img);
imag
?>
Kod sprawdzający poprawność:
function passcheck($pass) {
for($i = 0; $i < strlen($pass); $i++) if($i % 2 == 0) $a .= $pass[$i]; else $b .= $pass[$i];
if($a + $b <= $nr && $a + $b >= $nr - 2) return true;
return false;
}
Ps. Ten kod nie jest napisany przeze mnie ale nie pamiętam autora.