Cytat(Pawel_W @ 21.09.2010, 22:37:18 )

może kolega nie wie, ale w php da się operować na obrazkach tylko bibliotekami (gd to też biblioteka...)
najprościej Ci będzie napisać własny, strukturalny kod, który wygeneruje coś takiego, bez użycia ogólnodostępnych narzędzi
[ironia /off]
Wiem , że w php da się operować na obrazkach tylko bibliotekami. Po prostu źle się wyraziłem. Chciałbym uzyskać taki efekt bez dodatkowych bibliotek. GD mam już zainstalowaną.

A tak odbiegając od tematu to czy taka CAPTCHA jest bezpieczna (chodzi w niej o podanie wyniku działania)

:
<?php
$captcha_w = 177;
$captcha_h = 31;
$min_font_size = 16;
$max_font_size = 19;
$angle = 20;
$bg_size = 8.1;
$font_path = 'courbd.ttf';
$operators = array('+','-','*'); $second_num = rand(6
,11
);
$expression = $second_num.$operators[0].$first_num;
eval("\$session_var=".$second_num.$operators[0
].$first_num.";");
$_SESSION['security_number'] = $session_var;
$img = imagecreate( $captcha_w, $captcha_h );
$black = imagecolorallocate($img,0,0,0);
$white = imagecolorallocate($img,255,255,255);
$grey = imagecolorallocate($img,215,215,215);
$lcolor1 = imagecolorallocate
($img, rand(0
, 190
), rand(0
, 190
), rand(0
, 190
)); $lcolor2 = imagecolorallocate
($img, rand(0
, 190
), rand(0
, 190
), rand(0
, 190
)); $lcolor3 = imagecolorallocate
($img, rand(0
, 190
), rand(0
, 190
), rand(0
, 190
));
imagefill($img, 0, 0, $white);
for ($t = $bg_size; $t<$captcha_w; $t+=$bg_size){
imageline($img, $t, 0, $t, $captcha_h, $grey);
}
for ($t = $bg_size; $t<$captcha_h; $t+=$bg_size){
imageline($img, 0, $t, $captcha_w, $t, $grey);
}
$item_space = $captcha_w/3;
imagettftext(
$img,
$min_font_size,
$max_font_size
),
rand( -$angle , $angle ), rand( 10
, $item_space-28
), rand( 25
, $captcha_h-10
), $lcolor1,
$font_path,
$second_num);
imagettftext(
$img,
20,
rand( $item_space, 2
*$item_space-28
), rand( 25
, $captcha_h-5
), $lcolor2,
$font_path,
$operators[0]);
imagettftext(
$img,
$min_font_size,
$max_font_size
),
rand( 2
*$item_space, 3
*$item_space-40
), rand( 25
, $captcha_h-10
), $lcolor3,
$font_path,
$first_num);
header("Content-type:image/png"); header("Content-Disposition:inline ; filename=secure.png"); imagepng($img);
?>