diff --git a/engine/lib/external/kcaptcha/fonts/antiqua.png b/engine/lib/external/kcaptcha/fonts/antiqua.png deleted file mode 100644 index 78d93d59..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/antiqua.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/baskerville.png b/engine/lib/external/kcaptcha/fonts/baskerville.png deleted file mode 100644 index 5a635287..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/baskerville.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/batang.png b/engine/lib/external/kcaptcha/fonts/batang.png deleted file mode 100644 index ba007563..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/batang.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/bookman.png b/engine/lib/external/kcaptcha/fonts/bookman.png deleted file mode 100644 index 1132a122..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/bookman.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/calisto.png b/engine/lib/external/kcaptcha/fonts/calisto.png deleted file mode 100644 index b3b0dd56..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/calisto.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/cambria.png b/engine/lib/external/kcaptcha/fonts/cambria.png deleted file mode 100644 index 76ad9210..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/cambria.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/centaur.png b/engine/lib/external/kcaptcha/fonts/centaur.png deleted file mode 100644 index 30a46cad..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/centaur.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/century.png b/engine/lib/external/kcaptcha/fonts/century.png deleted file mode 100644 index abf89d7e..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/century.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/chaparral.png b/engine/lib/external/kcaptcha/fonts/chaparral.png deleted file mode 100644 index 7395bacd..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/chaparral.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/constantia.png b/engine/lib/external/kcaptcha/fonts/constantia.png deleted file mode 100644 index d3abc646..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/constantia.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/footlight.png b/engine/lib/external/kcaptcha/fonts/footlight.png deleted file mode 100644 index cb2a634e..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/footlight.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/garamond.png b/engine/lib/external/kcaptcha/fonts/garamond.png deleted file mode 100644 index eb722212..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/garamond.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/georgia.png b/engine/lib/external/kcaptcha/fonts/georgia.png deleted file mode 100644 index d00bb75e..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/georgia.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/goudy_old.png b/engine/lib/external/kcaptcha/fonts/goudy_old.png deleted file mode 100644 index b4d236d9..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/goudy_old.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/kozuka.png b/engine/lib/external/kcaptcha/fonts/kozuka.png deleted file mode 100644 index ececa110..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/kozuka.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/lucida.png b/engine/lib/external/kcaptcha/fonts/lucida.png deleted file mode 100644 index 050732aa..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/lucida.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/minion.png b/engine/lib/external/kcaptcha/fonts/minion.png deleted file mode 100644 index 34384e51..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/minion.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/palatino.png b/engine/lib/external/kcaptcha/fonts/palatino.png deleted file mode 100644 index 3a9d37b2..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/palatino.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/palatino_linotype_bold.png b/engine/lib/external/kcaptcha/fonts/palatino_linotype_bold.png new file mode 100755 index 00000000..76e653ad Binary files /dev/null and b/engine/lib/external/kcaptcha/fonts/palatino_linotype_bold.png differ diff --git a/engine/lib/external/kcaptcha/fonts/perpetua.png b/engine/lib/external/kcaptcha/fonts/perpetua.png deleted file mode 100644 index 8b4c0871..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/perpetua.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/perpetua_bold.png b/engine/lib/external/kcaptcha/fonts/perpetua_bold.png new file mode 100755 index 00000000..861ea50e Binary files /dev/null and b/engine/lib/external/kcaptcha/fonts/perpetua_bold.png differ diff --git a/engine/lib/external/kcaptcha/fonts/rockwell.png b/engine/lib/external/kcaptcha/fonts/rockwell.png deleted file mode 100644 index da19566d..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/rockwell.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/times.png b/engine/lib/external/kcaptcha/fonts/times.png deleted file mode 100644 index 656e99d9..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/times.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/fonts/times_bold.png b/engine/lib/external/kcaptcha/fonts/times_bold.png new file mode 100755 index 00000000..40481210 Binary files /dev/null and b/engine/lib/external/kcaptcha/fonts/times_bold.png differ diff --git a/engine/lib/external/kcaptcha/fonts/warnock.png b/engine/lib/external/kcaptcha/fonts/warnock.png deleted file mode 100644 index c114dbcb..00000000 Binary files a/engine/lib/external/kcaptcha/fonts/warnock.png and /dev/null differ diff --git a/engine/lib/external/kcaptcha/kcaptcha.php b/engine/lib/external/kcaptcha/kcaptcha.php old mode 100644 new mode 100755 index f3e21abb..88beb085 --- a/engine/lib/external/kcaptcha/kcaptcha.php +++ b/engine/lib/external/kcaptcha/kcaptcha.php @@ -1,15 +1,15 @@ keystring{$i}]; - $y=mt_rand(-$fluctuation_amplitude, $fluctuation_amplitude)+($height-$fontfile_height)/2+2; + $y=(($i%2)*$fluctuation_amplitude - $fluctuation_amplitude/2)*$odd + + mt_rand(-round($fluctuation_amplitude/3), round($fluctuation_amplitude/3)) + + ($height-$fontfile_height)/2; if($no_spaces){ $shift=0; if($i>0){ $shift=10000; - for($sy=7;$sy<$fontfile_height-20;$sy+=1){ + for($sy=3;$sy<$fontfile_height-10;$sy+=1){ for($sx=$m['start']-1;$sx<$m['end'];$sx+=1){ $rgb=imagecolorat($font, $sx, $sy); $opacity=$rgb>>24; @@ -98,9 +104,9 @@ class KCAPTCHA{ $left=$sx-$m['start']+$x; $py=$sy+$y; if($py>$height) break; - for($px=min($left,$width-1);$px>$left-12 && $px>=0;$px-=1){ + for($px=min($left,$width-1);$px>$left-200 && $px>=0;$px-=1){ $color=imagecolorat($img, $px, $py) & 0xff; - if($color+$opacity<190){ + if($color+$opacity<170){ // 170 - threshold if($shift>$left-$px){ $shift=$left-$px; } @@ -124,6 +130,17 @@ class KCAPTCHA{ } }while($x>=$width-10); // while not fit in canvas + //noise + $white=imagecolorallocate($font, 255, 255, 255); + $black=imagecolorallocate($font, 0, 0, 0); + for($i=0;$i<(($height-30)*$x)*$white_noise_density;$i++){ + imagesetpixel($img, mt_rand(0, $x-1), mt_rand(10, $height-15), $white); + } + for($i=0;$i<(($height-30)*$x)*$black_noise_density;$i++){ + imagesetpixel($img, mt_rand(0, $x-1), mt_rand(10, $height-15), $black); + } + + $center=$x/2; // credits. To remove, see configuration file @@ -147,7 +164,7 @@ class KCAPTCHA{ $rand8=mt_rand(0,31415926)/10000000; // amplitudes $rand9=mt_rand(330,420)/110; - $rand10=mt_rand(330,450)/110; + $rand10=mt_rand(330,450)/100; //wave distortion @@ -200,7 +217,6 @@ class KCAPTCHA{ header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', FALSE); header('Pragma: no-cache'); - if(function_exists("imagejpeg")){ header("Content-Type: image/jpeg"); imagejpeg($img2, null, $jpeg_quality); diff --git a/engine/lib/external/kcaptcha/kcaptcha_config.php b/engine/lib/external/kcaptcha/kcaptcha_config.php old mode 100644 new mode 100755 index 807b6bb8..1f373373 --- a/engine/lib/external/kcaptcha/kcaptcha_config.php +++ b/engine/lib/external/kcaptcha/kcaptcha_config.php @@ -6,21 +6,28 @@ $alphabet = "0123456789abcdefghijklmnopqrstuvwxyz"; # do not change without chan # symbols used to draw CAPTCHA //$allowed_symbols = "0123456789"; #digits -$allowed_symbols = "23456789abcdeghkmnpqsuvxyz"; #alphabet without similar symbols (o=0, 1=l, i=j, t=f) +//$allowed_symbols = "23456789abcdegkmnpqsuvxyz"; #alphabet without similar symbols (o=0, 1=l, i=j, t=f) +$allowed_symbols = "23456789abcdegikpqsvxyz"; #alphabet without similar symbols (o=0, 1=l, i=j, t=f) # folder with fonts $fontsdir = 'fonts'; # CAPTCHA string length -//$length = mt_rand(5,6); # random 5 or 6 +//$length = mt_rand(5,7); # random 5 or 6 or 7 $length = 3; -# CAPTCHA image size (you do not need to change it, whis parameters is optimal) +# CAPTCHA image size (you do not need to change it, this parameters is optimal) $width = 80; -$height = 40; +$height = 60; -# symbol's vertical fluctuation amplitude divided by 2 -$fluctuation_amplitude = 5; +# symbol's vertical fluctuation amplitude +$fluctuation_amplitude = 8; + +#noise +//$white_noise_density=0; // no white noise +$white_noise_density=1/6; +//$black_noise_density=0; // no black noise +$black_noise_density=1/30; # increase safety by prevention of spaces between symbols $no_spaces = true; @@ -32,8 +39,8 @@ $credits = 'www.captcha.ru'; # if empty, HTTP_HOST will be shown # CAPTCHA image colors (RGB, 0-255) //$foreground_color = array(0, 0, 0); //$background_color = array(220, 230, 255); -$foreground_color = array(mt_rand(0,100), mt_rand(0,100), mt_rand(0,100)); -$background_color = array(mt_rand(200,255), mt_rand(200,255), mt_rand(200,255)); +$foreground_color = array(mt_rand(0,80), mt_rand(0,80), mt_rand(0,80)); +$background_color = array(mt_rand(220,255), mt_rand(220,255), mt_rand(220,255)); # JPEG quality of CAPTCHA image (bigger is better quality, but larger file size) $jpeg_quality = 90;