Vergleich captcha.php - 1.8.5 - 1.8.24

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 95Zeile 95
imagefill($im, 0, 0, $bg_color);

// Draw random circles, squares or lines?

imagefill($im, 0, 0, $bg_color);

// Draw random circles, squares or lines?

$to_draw = my_rand(0, 2);

$to_draw = rand(0, 2);

if($to_draw == 1)
{
draw_circles($im);

if($to_draw == 1)
{
draw_circles($im);

Zeile 127Zeile 127
/**
* Draws a random number of lines on the image.
*

/**
* Draws a random number of lines on the image.
*

 * @param resource The image.

 * @param resource $im The image.

 */
function draw_lines(&$im)
{

 */
function draw_lines(&$im)
{

Zeile 135Zeile 135

for($i = 10; $i < $img_width; $i += 10)
{


for($i = 10; $i < $img_width; $i += 10)
{

		$color = imagecolorallocate($im, my_rand(150, 255), my_rand(150, 255), my_rand(150, 255));

		$color = imagecolorallocate($im, rand(150, 255), rand(150, 255), rand(150, 255));

		imageline($im, $i, 0, $i, $img_height, $color);
}
for($i = 10; $i < $img_height; $i += 10)
{

		imageline($im, $i, 0, $i, $img_height, $color);
}
for($i = 10; $i < $img_height; $i += 10)
{

		$color = imagecolorallocate($im, my_rand(150, 255), my_rand(150, 255), my_rand(150, 255));

		$color = imagecolorallocate($im, rand(150, 255), rand(150, 255), rand(150, 255));

		imageline($im, 0, $i, $img_width, $i, $color);
}
}

		imageline($im, 0, $i, $img_width, $i, $color);
}
}

Zeile 148Zeile 148
/**
* Draws a random number of circles on the image.
*

/**
* Draws a random number of circles on the image.
*

 * @param resource The image.

 * @param resource $im The image.

 */
function draw_circles(&$im)
{

 */
function draw_circles(&$im)
{

Zeile 157Zeile 157
	$circles = $img_width*$img_height / 100;
for($i = 0; $i <= $circles; ++$i)
{

	$circles = $img_width*$img_height / 100;
for($i = 0; $i <= $circles; ++$i)
{

		$color = imagecolorallocate($im, my_rand(180, 255), my_rand(180, 255), my_rand(180, 255));
$pos_x = my_rand(1, $img_width);
$pos_y = my_rand(1, $img_height);
$circ_width = ceil(my_rand(1, $img_width)/2);
$circ_height = my_rand(1, $img_height);
imagearc($im, $pos_x, $pos_y, $circ_width, $circ_height, 0, my_rand(200, 360), $color);

		$color = imagecolorallocate($im, rand(180, 255), rand(180, 255), rand(180, 255));
$pos_x = rand(1, $img_width);
$pos_y = rand(1, $img_height);
$circ_width = ceil(rand(1, $img_width)/2);
$circ_height = rand(1, $img_height);
imagearc($im, $pos_x, $pos_y, $circ_width, $circ_height, 0, rand(200, 360), $color);

	}
}

/**
* Draws a random number of dots on the image.
*

	}
}

/**
* Draws a random number of dots on the image.
*

 * @param resource The image.

 * @param resource $im The image.

 */
function draw_dots(&$im)
{

 */
function draw_dots(&$im)
{

Zeile 178Zeile 178
	$dot_count = $img_width*$img_height/5;
for($i = 0; $i <= $dot_count; ++$i)
{

	$dot_count = $img_width*$img_height/5;
for($i = 0; $i <= $dot_count; ++$i)
{

		$color = imagecolorallocate($im, my_rand(200, 255), my_rand(200, 255), my_rand(200, 255));
imagesetpixel($im, my_rand(0, $img_width), my_rand(0, $img_height), $color);

		$color = imagecolorallocate($im, rand(200, 255), rand(200, 255), rand(200, 255));
imagesetpixel($im, rand(0, $img_width), rand(0, $img_height), $color);

	}
}

/**
* Draws a random number of squares on the image.
*

	}
}

/**
* Draws a random number of squares on the image.
*

 * @param resource The image.

 * @param resource $im The image.

 */
function draw_squares(&$im)
{

 */
function draw_squares(&$im)
{

Zeile 195Zeile 195
	$square_count = 30;
for($i = 0; $i <= $square_count; ++$i)
{

	$square_count = 30;
for($i = 0; $i <= $square_count; ++$i)
{

		$color = imagecolorallocate($im, my_rand(150, 255), my_rand(150, 255), my_rand(150, 255));
$pos_x = my_rand(1, $img_width);
$pos_y = my_rand(1, $img_height);
$sq_width = $sq_height = my_rand(10, 20);

		$color = imagecolorallocate($im, rand(150, 255), rand(150, 255), rand(150, 255));
$pos_x = rand(1, $img_width);
$pos_y = rand(1, $img_height);
$sq_width = $sq_height = rand(10, 20);

		$pos_x2 = $pos_x + $sq_height;
$pos_y2 = $pos_y + $sq_width;
imagefilledrectangle($im, $pos_x, $pos_y, $pos_x2, $pos_y2, $color);

		$pos_x2 = $pos_x + $sq_height;
$pos_y2 = $pos_y + $sq_width;
imagefilledrectangle($im, $pos_x, $pos_y, $pos_x2, $pos_y2, $color);

Zeile 208Zeile 208
/**
* Writes text to the image.
*

/**
* Writes text to the image.
*

 * @param resource The image.
* @param string The string to be written



 * @param resource $im The image.
* @param string $string The string to be written
*
* @return bool False if string is empty, true otherwise

 */
function draw_string(&$im, $string)
{

 */
function draw_string(&$im, $string)
{

Zeile 228Zeile 230
		if($use_ttf)
{
// Select a random font size

		if($use_ttf)
{
// Select a random font size

			$font_size = my_rand($min_size, $max_size);

			$font_size = rand($min_size, $max_size);


// Select a random font
$font = array_rand($ttf_fonts);
$font = $ttf_fonts[$font];

// Select a random rotation


// Select a random font
$font = array_rand($ttf_fonts);
$font = $ttf_fonts[$font];

// Select a random rotation

			$rotation = my_rand($min_angle, $max_angle);

			$rotation = rand($min_angle, $max_angle);


// Set the colour


// Set the colour

			$r = my_rand(0, 200);
$g = my_rand(0, 200);
$b = my_rand(0, 200);

			$r = rand(0, 200);
$g = rand(0, 200);
$b = rand(0, 200);

			$color = imagecolorallocate($im, $r, $g, $b);

// Fetch the dimensions of the character being added

			$color = imagecolorallocate($im, $r, $g, $b);

// Fetch the dimensions of the character being added

Zeile 254Zeile 256
			$pos_y = ceil(($img_height-$string_height/2));

// Draw a shadow

			$pos_y = ceil(($img_height-$string_height/2));

// Draw a shadow

			$shadow_x = my_rand(-3, 3) + $pos_x;
$shadow_y = my_rand(-3, 3) + $pos_y;

			$shadow_x = rand(-3, 3) + $pos_x;
$shadow_y = rand(-3, 3) + $pos_y;

			$shadow_color = imagecolorallocate($im, $r+20, $g+20, $b+20);
imagefttext($im, $font_size, $rotation, $shadow_x, $shadow_y, $shadow_color, $font, $string[$i], array());


			$shadow_color = imagecolorallocate($im, $r+20, $g+20, $b+20);
imagefttext($im, $font_size, $rotation, $shadow_x, $shadow_y, $shadow_color, $font, $string[$i], array());


Zeile 270Zeile 272

// Calculate character offsets
$pos_x = $spacing / 4 + $i * $spacing;


// Calculate character offsets
$pos_x = $spacing / 4 + $i * $spacing;

			$pos_y = $img_height / 2 - $string_height -10 + my_rand(-3, 3);

			$pos_y = $img_height / 2 - $string_height -10 + rand(-3, 3);


// Create a temporary image for this character
if(gd_version() >= 2)


// Create a temporary image for this character
if(gd_version() >= 2)

Zeile 286Zeile 288
			imagecolortransparent($temp_im, $bg_color);

// Set the colour

			imagecolortransparent($temp_im, $bg_color);

// Set the colour

			$r = my_rand(0, 200);
$g = my_rand(0, 200);
$b = my_rand(0, 200);

			$r = rand(0, 200);
$g = rand(0, 200);
$b = rand(0, 200);

			$color = imagecolorallocate($temp_im, $r, $g, $b);

// Draw a shadow

			$color = imagecolorallocate($temp_im, $r, $g, $b);

// Draw a shadow

			$shadow_x = my_rand(-1, 1);
$shadow_y = my_rand(-1, 1);

			$shadow_x = rand(-1, 1);
$shadow_y = rand(-1, 1);

			$shadow_color = imagecolorallocate($temp_im, $r+50, $g+50, $b+50);
imagestring($temp_im, 5, 1+$shadow_x, 1+$shadow_y, $string[$i], $shadow_color);


			$shadow_color = imagecolorallocate($temp_im, $r+50, $g+50, $b+50);
imagestring($temp_im, 5, 1+$shadow_x, 1+$shadow_y, $string[$i], $shadow_color);


Zeile 304Zeile 306
			imagedestroy($temp_im);
}
}

			imagedestroy($temp_im);
}
}

 
	return true;

}

}