Вход Регистрация
Файл: sys/includes/captcha.php
Строк: 47
<?
class captcha
{
var 
$str;
var 
$x 63;
var 
$y 27;
var 
$img;
var 
$gif=false;
var 
$png=false;
var 
$jpg=false;
function 
captcha($str)
{
if (!
function_exists('gd_info'))
{
header('Location: /err.php');
exit;
}
if (
imagetypes() & IMG_PNG)$this->png=true;
if (
imagetypes() & IMG_GIF)$this->gif=true;
if (
imagetypes() & IMG_JPG)$this->jpg=true;
$this->str=$str;
$this->img=imagecreatetruecolor($this->x$this->y);
imagefill($this->img00imagecolorallocate ($this->img000));
}
function 
create()
{
for (
$i=0;$i<;$i++ )
{
$n=$this->str{$i};
if (
$this->png)$num[$n]=imagecreatefrompng(H.'/s-klub/captcha/'.$n.'.png');
elseif (
$this->gif)$num[$n]=imagecreatefromgif(H.'/s-klub/captcha/'.$n.'.gif');
elseif (
$this->jpg)$num[$n]=imagecreatefromjpeg(H.'/s-klub/captcha/'.$n.'.jpg');
imagecopy($this->img$num[$n], $i*155551520);
}
}
function 
colorize($value=90)
{
if (
function_exists('imagefilter'))
imagefilter($this->imgIMG_FILTER_COLORIZEmt_rand(0$value), mt_rand(0$value), mt_rand(0$value));
}
function 
output($q=150)
{
@
ob_end_clean();
if (
$this->jpg)
{
header("Content-type: image/jpeg");
imagejpeg($this->img,null,$q);
}
elseif (
$this->png)
{
header("Content-type: image/png");
imagepng($this->img);
}
elseif (
$this->gif)
{
header("Content-type: image/gif");
imagegif($this->img);
}
exit;
}
}
?>
Онлайн: 1
Реклама