%PDF-1.5 % ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY
| Server IP : 122.155.17.190 / Your IP : 216.73.216.99 Web Server : Apache/2 System : Linux cat17190.thaihostserver.com 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 User : bungkla ( 1054) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/bungkla/domains/bungkla.go.th/public_html/captcha/ |
Upload File : |
<?php
class captchaZDR {
var $UserString;
var $font_path;
function captchaZDR(){
$fonts = array('Vera.ttf', 'VeraBI.ttf', 'VeraIt.ttf', 'VeraMono.ttf', 'VeraMoBI.ttf', 'VeraMoIt.ttf', 'VeraSe.ttf', 'VeraSeBd.ttf');
shuffle($fonts);
$this->font_path = './fonts/'.current($fonts);
}
function LoadPNG(){
$bgNUM = rand(1,8);
$im = @imagecreatefrompng('./png/bg'.$bgNUM.'.png'); /* Attempt to open */
if (!$im) {
$im = imagecreatetruecolor(150, 30); /* Create a blank image */
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
imagestring($im, 1, 5, 5, "Error loading $imgname", $tc);
}
return $im;
}
function drawElipse($image){
for($i=0;$i<5;$i++){
// choose a color for the ellipse
$red = rand(0,155);
$green = rand(0,155);
$blue = rand(0,155);
$col_ellipse = imagecolorallocate($image, $red, $green, $blue);
// draw the ellipse
$cx = rand(50,250);
$cy = rand(50,250);
$cw = rand(30,250);
$ch = rand(20,250);
imageellipse($image, $cx, $cy, $cw, $ch, $col_ellipse);
}
/*foreach (range('0', '9') as $letter) {
$red = rand(0,155);
$green = rand(0,155);
$blue = rand(0,155);
$col_ellipse = imagecolorallocate($image, $red, $green, $blue);
$font_size = 2; //rand(1,12);
$x = rand(0,180);
$y = rand(0,80);
imagechar($image, $font_size, $x, $y, $letter, $col_ellipse);
} */
foreach (range('0', '9') as $letter) {
$red = rand(0,155);
$green = rand(0,155);
$blue = rand(0,155);
$col_ellipse = imagecolorallocate($image, $red, $green, $blue);
$font_size = 2;
$x = rand(0,180);
$y = rand(0,80);
imagechar($image, $font_size, $x, $y, $letter, $col_ellipse);
}
}
function task_string(){
// create a image from png bank
$image = $this->LoadPNG();
$string_a = array("0","1",
"2","3","4","5","6","7","8","9","0","1",
"2","3","4","5","6","7","8","9");
$width=0;
for($i=0;$i<5;$i++)
{
$colour = imagecolorallocate($image, rand(0,155), rand(0,155), rand(0,155));
$font = $this->font_path;
$angle = rand(-15,15);
// Add the text
$width_pos = rand(15,20);
$width = $width + $width_pos;
// $height = rand(35,75);
$height = rand(30,40);
$temp = $string_a[rand(0,20)];
$this->UserString .= $temp;
imagettftext($image, 26, $angle, $width, $height, $colour, $font, $temp);
$width = $width + 3;
$height = $height + 3;
imagettftext($image, 26, $angle, $width, $height, $colour, $font, $temp);
}
$_SESSION['captcha'] = $this->UserString;
return $image;
}
function display(){
$image = $this->task_string();
$this->drawElipse($image);
// output the picture
header("Content-type: image/png");
imagepng($image);
}
function check_result(){
if($_SESSION['captcha']!=$_REQUEST['capt'] || $_SESSION['captcha']=='BADCODE')
{
$_SESSION['captcha']='BADCODE';
return false;
}
else
{
return true;
}
}
}
?>