Обновление KCaptcha до 2.0
BIN
engine/lib/external/kcaptcha/fonts/antiqua.png
vendored
Before Width: | Height: | Size: 6.3 KiB |
BIN
engine/lib/external/kcaptcha/fonts/baskerville.png
vendored
Before Width: | Height: | Size: 6.3 KiB |
BIN
engine/lib/external/kcaptcha/fonts/batang.png
vendored
Before Width: | Height: | Size: 7.1 KiB |
BIN
engine/lib/external/kcaptcha/fonts/bookman.png
vendored
Before Width: | Height: | Size: 6.7 KiB |
BIN
engine/lib/external/kcaptcha/fonts/calisto.png
vendored
Before Width: | Height: | Size: 7.9 KiB |
BIN
engine/lib/external/kcaptcha/fonts/cambria.png
vendored
Before Width: | Height: | Size: 6.3 KiB |
BIN
engine/lib/external/kcaptcha/fonts/centaur.png
vendored
Before Width: | Height: | Size: 7.3 KiB |
BIN
engine/lib/external/kcaptcha/fonts/century.png
vendored
Before Width: | Height: | Size: 6.8 KiB |
BIN
engine/lib/external/kcaptcha/fonts/chaparral.png
vendored
Before Width: | Height: | Size: 7.4 KiB |
BIN
engine/lib/external/kcaptcha/fonts/constantia.png
vendored
Before Width: | Height: | Size: 6.1 KiB |
BIN
engine/lib/external/kcaptcha/fonts/footlight.png
vendored
Before Width: | Height: | Size: 6.7 KiB |
BIN
engine/lib/external/kcaptcha/fonts/garamond.png
vendored
Before Width: | Height: | Size: 6.9 KiB |
BIN
engine/lib/external/kcaptcha/fonts/georgia.png
vendored
Before Width: | Height: | Size: 7 KiB |
BIN
engine/lib/external/kcaptcha/fonts/goudy_old.png
vendored
Before Width: | Height: | Size: 6.9 KiB |
BIN
engine/lib/external/kcaptcha/fonts/kozuka.png
vendored
Before Width: | Height: | Size: 7.1 KiB |
BIN
engine/lib/external/kcaptcha/fonts/lucida.png
vendored
Before Width: | Height: | Size: 6.3 KiB |
BIN
engine/lib/external/kcaptcha/fonts/minion.png
vendored
Before Width: | Height: | Size: 6.8 KiB |
BIN
engine/lib/external/kcaptcha/fonts/palatino.png
vendored
Before Width: | Height: | Size: 7 KiB |
BIN
engine/lib/external/kcaptcha/fonts/palatino_linotype_bold.png
vendored
Executable file
After Width: | Height: | Size: 15 KiB |
BIN
engine/lib/external/kcaptcha/fonts/perpetua.png
vendored
Before Width: | Height: | Size: 6.7 KiB |
BIN
engine/lib/external/kcaptcha/fonts/perpetua_bold.png
vendored
Executable file
After Width: | Height: | Size: 13 KiB |
BIN
engine/lib/external/kcaptcha/fonts/rockwell.png
vendored
Before Width: | Height: | Size: 5.7 KiB |
BIN
engine/lib/external/kcaptcha/fonts/times.png
vendored
Before Width: | Height: | Size: 6.7 KiB |
BIN
engine/lib/external/kcaptcha/fonts/times_bold.png
vendored
Executable file
After Width: | Height: | Size: 14 KiB |
BIN
engine/lib/external/kcaptcha/fonts/warnock.png
vendored
Before Width: | Height: | Size: 7.5 KiB |
34
engine/lib/external/kcaptcha/kcaptcha.php
vendored
Normal file → Executable file
|
@ -1,15 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
# KCAPTCHA PROJECT VERSION 1.2.6
|
# KCAPTCHA PROJECT VERSION 2.0
|
||||||
|
|
||||||
# Automatic test to tell computers and humans apart
|
# Automatic test to tell computers and humans apart
|
||||||
|
|
||||||
# Copyright by Kruglov Sergei, 2006, 2007, 2008
|
# Copyright by Kruglov Sergei, 2006, 2007, 2008, 2011
|
||||||
# www.captcha.ru, www.kruglov.ru
|
# www.captcha.ru, www.kruglov.ru
|
||||||
|
|
||||||
# System requirements: PHP 4.0.6+ w/ GD
|
# System requirements: PHP 4.0.6+ w/ GD
|
||||||
|
|
||||||
# KCAPTCHA is a free software. You can freely use it for building own site or software.
|
# KCAPTCHA is a free software. You can freely use it for developing own site or software.
|
||||||
# If you use this software as a part of own sofware, you must leave copyright notices intact or add KCAPTCHA copyright notices to own.
|
# If you use this software as a part of own sofware, you must leave copyright notices intact or add KCAPTCHA copyright notices to own.
|
||||||
# As a default configuration, KCAPTCHA has a small credits text at bottom of CAPTCHA image.
|
# As a default configuration, KCAPTCHA has a small credits text at bottom of CAPTCHA image.
|
||||||
# You can remove it, but I would be pleased if you left it. ;)
|
# You can remove it, but I would be pleased if you left it. ;)
|
||||||
|
@ -48,8 +48,10 @@ class KCAPTCHA{
|
||||||
$font_file=$fonts[mt_rand(0, count($fonts)-1)];
|
$font_file=$fonts[mt_rand(0, count($fonts)-1)];
|
||||||
$font=imagecreatefrompng($font_file);
|
$font=imagecreatefrompng($font_file);
|
||||||
imagealphablending($font, true);
|
imagealphablending($font, true);
|
||||||
|
|
||||||
$fontfile_width=imagesx($font);
|
$fontfile_width=imagesx($font);
|
||||||
$fontfile_height=imagesy($font)-1;
|
$fontfile_height=imagesy($font)-1;
|
||||||
|
|
||||||
$font_metrics=array();
|
$font_metrics=array();
|
||||||
$symbol=0;
|
$symbol=0;
|
||||||
$reading_symbol=false;
|
$reading_symbol=false;
|
||||||
|
@ -81,16 +83,20 @@ class KCAPTCHA{
|
||||||
|
|
||||||
// draw text
|
// draw text
|
||||||
$x=1;
|
$x=1;
|
||||||
|
$odd=mt_rand(0,1);
|
||||||
|
if($odd==0) $odd=-1;
|
||||||
for($i=0;$i<$length;$i++){
|
for($i=0;$i<$length;$i++){
|
||||||
$m=$font_metrics[$this->keystring{$i}];
|
$m=$font_metrics[$this->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){
|
if($no_spaces){
|
||||||
$shift=0;
|
$shift=0;
|
||||||
if($i>0){
|
if($i>0){
|
||||||
$shift=10000;
|
$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){
|
for($sx=$m['start']-1;$sx<$m['end'];$sx+=1){
|
||||||
$rgb=imagecolorat($font, $sx, $sy);
|
$rgb=imagecolorat($font, $sx, $sy);
|
||||||
$opacity=$rgb>>24;
|
$opacity=$rgb>>24;
|
||||||
|
@ -98,9 +104,9 @@ class KCAPTCHA{
|
||||||
$left=$sx-$m['start']+$x;
|
$left=$sx-$m['start']+$x;
|
||||||
$py=$sy+$y;
|
$py=$sy+$y;
|
||||||
if($py>$height) break;
|
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;
|
$color=imagecolorat($img, $px, $py) & 0xff;
|
||||||
if($color+$opacity<190){
|
if($color+$opacity<170){ // 170 - threshold
|
||||||
if($shift>$left-$px){
|
if($shift>$left-$px){
|
||||||
$shift=$left-$px;
|
$shift=$left-$px;
|
||||||
}
|
}
|
||||||
|
@ -124,6 +130,17 @@ class KCAPTCHA{
|
||||||
}
|
}
|
||||||
}while($x>=$width-10); // while not fit in canvas
|
}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;
|
$center=$x/2;
|
||||||
|
|
||||||
// credits. To remove, see configuration file
|
// credits. To remove, see configuration file
|
||||||
|
@ -147,7 +164,7 @@ class KCAPTCHA{
|
||||||
$rand8=mt_rand(0,31415926)/10000000;
|
$rand8=mt_rand(0,31415926)/10000000;
|
||||||
// amplitudes
|
// amplitudes
|
||||||
$rand9=mt_rand(330,420)/110;
|
$rand9=mt_rand(330,420)/110;
|
||||||
$rand10=mt_rand(330,450)/110;
|
$rand10=mt_rand(330,450)/100;
|
||||||
|
|
||||||
//wave distortion
|
//wave distortion
|
||||||
|
|
||||||
|
@ -200,7 +217,6 @@ class KCAPTCHA{
|
||||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||||
header('Cache-Control: post-check=0, pre-check=0', FALSE);
|
header('Cache-Control: post-check=0, pre-check=0', FALSE);
|
||||||
header('Pragma: no-cache');
|
header('Pragma: no-cache');
|
||||||
|
|
||||||
if(function_exists("imagejpeg")){
|
if(function_exists("imagejpeg")){
|
||||||
header("Content-Type: image/jpeg");
|
header("Content-Type: image/jpeg");
|
||||||
imagejpeg($img2, null, $jpeg_quality);
|
imagejpeg($img2, null, $jpeg_quality);
|
||||||
|
|
23
engine/lib/external/kcaptcha/kcaptcha_config.php
vendored
Normal file → Executable file
|
@ -6,21 +6,28 @@ $alphabet = "0123456789abcdefghijklmnopqrstuvwxyz"; # do not change without chan
|
||||||
|
|
||||||
# symbols used to draw CAPTCHA
|
# symbols used to draw CAPTCHA
|
||||||
//$allowed_symbols = "0123456789"; #digits
|
//$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
|
# folder with fonts
|
||||||
$fontsdir = 'fonts';
|
$fontsdir = 'fonts';
|
||||||
|
|
||||||
# CAPTCHA string length
|
# 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;
|
$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;
|
$width = 80;
|
||||||
$height = 40;
|
$height = 60;
|
||||||
|
|
||||||
# symbol's vertical fluctuation amplitude divided by 2
|
# symbol's vertical fluctuation amplitude
|
||||||
$fluctuation_amplitude = 5;
|
$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
|
# increase safety by prevention of spaces between symbols
|
||||||
$no_spaces = true;
|
$no_spaces = true;
|
||||||
|
@ -32,8 +39,8 @@ $credits = 'www.captcha.ru'; # if empty, HTTP_HOST will be shown
|
||||||
# CAPTCHA image colors (RGB, 0-255)
|
# CAPTCHA image colors (RGB, 0-255)
|
||||||
//$foreground_color = array(0, 0, 0);
|
//$foreground_color = array(0, 0, 0);
|
||||||
//$background_color = array(220, 230, 255);
|
//$background_color = array(220, 230, 255);
|
||||||
$foreground_color = array(mt_rand(0,100), mt_rand(0,100), mt_rand(0,100));
|
$foreground_color = array(mt_rand(0,80), mt_rand(0,80), mt_rand(0,80));
|
||||||
$background_color = array(mt_rand(200,255), mt_rand(200,255), mt_rand(200,255));
|
$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 of CAPTCHA image (bigger is better quality, but larger file size)
|
||||||
$jpeg_quality = 90;
|
$jpeg_quality = 90;
|
||||||
|
|