Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/eula.html *
|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/eula.html *
|
* $Id: captcha.php 2148 2006-08-27 04:10:33Z Tikitiki $
| * $Id: captcha.php 2542 2006-12-19 23:43:47Z Tikitiki $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 28 | Zeile 28 |
---|
{ $imagestring = "MyBB"; }
|
{ $imagestring = "MyBB"; }
|
else {
| elseif($mybb->input['imagehash']) {
|
$query = $db->simple_select(TABLE_PREFIX."captcha", "*", "imagehash='".$db->escape_string($mybb->input['imagehash'])."'", array("limit" => 1)); $regimage = $db->fetch_array($query); $imagestring = $regimage['imagestring'];
|
$query = $db->simple_select(TABLE_PREFIX."captcha", "*", "imagehash='".$db->escape_string($mybb->input['imagehash'])."'", array("limit" => 1)); $regimage = $db->fetch_array($query); $imagestring = $regimage['imagestring'];
|
| } else { return false;
|
} $ttf_fonts = array();
| } $ttf_fonts = array();
|
Zeile 94 | Zeile 98 |
---|
else if($to_draw == 2) { draw_squares($im);
|
else if($to_draw == 2) { draw_squares($im);
|
}
| }
|
else { draw_lines($im); }
|
else { draw_lines($im); }
|
|
|
// Draw dots on the image draw_dots($im);
| // Draw dots on the image draw_dots($im);
|
Zeile 109 | Zeile 113 |
---|
// Draw a nice border around the image $border_color = imagecolorallocate($im, 0, 0, 0); imagerectangle($im, 0, 0, $img_width-1, $img_height-1, $border_color);
|
// Draw a nice border around the image $border_color = imagecolorallocate($im, 0, 0, 0); imagerectangle($im, 0, 0, $img_width-1, $img_height-1, $border_color);
|
|
|
// Output the image header("Content-type: image/png"); imagepng($im); imagedestroy($im); exit;
|
// Output the image header("Content-type: image/png"); imagepng($im); imagedestroy($im); exit;
|
/**
| /**
|
* Draws a random number of lines on the image. * * @param resource The image.
| * Draws a random number of lines on the image. * * @param resource The image.
|
Zeile 139 | Zeile 143 |
---|
/** * Draws a random number of circles on the image.
|
/** * Draws a random number of circles on the image.
|
*
| *
|
* @param resource The image. */ function draw_circles(&$im)
| * @param resource The image. */ function draw_circles(&$im)
|
Zeile 160 | Zeile 164 |
---|
/** * Draws a random number of dots on the image.
|
/** * Draws a random number of dots on the image.
|
* * @param resource The image.
| * * @param resource The image.
|
*/ function draw_dots(&$im)
|
*/ function draw_dots(&$im)
|
{
| {
|
global $img_width, $img_height; $dot_count = $img_width*$img_height/5;
| global $img_width, $img_height; $dot_count = $img_width*$img_height/5;
|
Zeile 183 | Zeile 187 |
---|
function draw_squares(&$im) { global $img_width, $img_height;
|
function draw_squares(&$im) { global $img_width, $img_height;
|
|
|
$square_count = 30; for($i = 0; $i <= $square_count; $i++)
|
$square_count = 30; for($i = 0; $i <= $square_count; $i++)
|
{
| {
|
$color = imagecolorallocate($im, rand(150, 255), rand(150, 255), rand(150, 255)); $pos_x = rand(1, $img_width); $pos_y = rand(1, $img_height);
| $color = imagecolorallocate($im, rand(150, 255), rand(150, 255), rand(150, 255)); $pos_x = rand(1, $img_width); $pos_y = rand(1, $img_height);
|
Zeile 194 | Zeile 198 |
---|
$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 206 | Zeile 210 |
---|
function draw_string(&$im, $string) { global $use_ttf, $min_size, $max_size, $min_angle, $max_angle, $ttf_fonts, $img_height, $img_width;
|
function draw_string(&$im, $string) { global $use_ttf, $min_size, $max_size, $min_angle, $max_angle, $ttf_fonts, $img_height, $img_width;
|
| if(empty($string)) { return false; }
|
$spacing = $img_width / my_strlen($string); $string_length = my_strlen($string);
| $spacing = $img_width / my_strlen($string); $string_length = my_strlen($string);
|
Zeile 249 | Zeile 258 |
---|
$shadow_x = rand(-3, 3) + $pos_x; $shadow_y = rand(-3, 3) + $pos_y; $shadow_color = imagecolorallocate($im, $r+20, $g+20, $b+20);
|
$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]);
| imagefttext($im, $font_size, $rotation, $shadow_x, $shadow_y, $shadow_color, $font, $string[$i], array());
|
// Write the character to the image
|
// Write the character to the image
|
imagefttext($im, $font_size, $rotation, $pos_x, $pos_y, $color, $font, $string[$i]);
| imagefttext($im, $font_size, $rotation, $pos_x, $pos_y, $color, $font, $string[$i], array());
|
} else {
| } else {
|