Witam mam taki sobie kodzik na token
token.php<?php
$img["width"] = 240;
$img["height"] = 86;
$img["text"] = $_GET['t'];
$img["file"] = @imagecreatefromjpeg ("token_background.jpg");
$font["angle"] = rand(-5
,5
); $font["files"] = array ( "stilltim.ttf", "dipedm.ttf", "zoinkfat.ttf" ); $font["file"] = $font["files"][$font["rand"]];
$token = imagecreatetruecolor ( $img["width"], $img["height"] );
$color["white"] = imagecolorallocate ( $token, 0,0,0 );
imagecopy ( $token, $img["file"], 0, 0, 0, 0, $img["width"], $img["height"] );
$box = imagettfbbox ( 24, $font["angle"], $font["file"], $img["text"] );
$x = (int
) ( ( $img["width"] - abs ( max ( $box[2
], $box[4
] ) ) ) / 2
); $y = (int
) ( ( $img["height"] + abs ( max ( $box[5
], $box[7
] ) ) ) / 2
);
imagecolorallocate ( $token, 0, 0, 0 );
imagettftext ( $token, 24, $font["angle"], $x, $y, $color["white"], $font["file"], $img["text"] );
header ( 'Content-type: image/gif' ); imagegif ( $token );
imagedestroy( $token );
?>
Teraz w pliku z formem mam
register.php<?php
$banned = array("#0#si", "#O#si");
echo '<img src="token.php?t='.$tekst.'" alt="">';
?>
Ale takie rozwiazanie latwo ominac bo kod tokena bedzie w kodzie a to roboty moga wychwycic. A Z kolei w pliku token.php nie moge generowac kodu bo bedzie mi on potrzebny w pliku form.php wiec jak mam to rozwiazac (IMG:
http://forum.php.pl/style_emoticons/default/questionmark.gif) ?