Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: captcha.php 4199 2008-09-20 04:13:52Z Tikitiki $
| * $Id: captcha.php 5379 2011-02-21 11:06:42Z Tomm $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 91 | Zeile 91 |
---|
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 = mt_rand(0, 2);
| $to_draw = my_rand(0, 2);
|
if($to_draw == 1) { draw_circles($im);
| if($to_draw == 1) { draw_circles($im);
|
Zeile 132 | Zeile 132 |
---|
for($i = 10; $i < $img_width; $i += 10) {
|
for($i = 10; $i < $img_width; $i += 10) {
|
$color = imagecolorallocate($im, mt_rand(150, 255), mt_rand(150, 255), mt_rand(150, 255));
| $color = imagecolorallocate($im, my_rand(150, 255), my_rand(150, 255), my_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, mt_rand(150, 255), mt_rand(150, 255), mt_rand(150, 255));
| $color = imagecolorallocate($im, my_rand(150, 255), my_rand(150, 255), my_rand(150, 255));
|
imageline($im, 0, $i, $img_width, $i, $color); } }
| imageline($im, 0, $i, $img_width, $i, $color); } }
|
Zeile 154 | Zeile 154 |
---|
$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, mt_rand(180, 255), mt_rand(180, 255), mt_rand(180, 255)); $pos_x = mt_rand(1, $img_width); $pos_y = mt_rand(1, $img_height); $circ_width = ceil(mt_rand(1, $img_width)/2); $circ_height = mt_rand(1, $img_height); imagearc($im, $pos_x, $pos_y, $circ_width, $circ_height, 0, mt_rand(200, 360), $color);
| $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);
|
} }
| } }
|
Zeile 175 | Zeile 175 |
---|
$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, mt_rand(200, 255), mt_rand(200, 255), mt_rand(200, 255)); imagesetpixel($im, mt_rand(0, $img_width), mt_rand(0, $img_height), $color);
| $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);
|
} }
| } }
|
Zeile 192 | Zeile 192 |
---|
$square_count = 30; for($i = 0; $i <= $square_count; ++$i) {
|
$square_count = 30; for($i = 0; $i <= $square_count; ++$i) {
|
$color = imagecolorallocate($im, mt_rand(150, 255), mt_rand(150, 255), mt_rand(150, 255)); $pos_x = mt_rand(1, $img_width); $pos_y = mt_rand(1, $img_height); $sq_width = $sq_height = mt_rand(10, 20);
| $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);
|
$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 225 | Zeile 225 |
---|
if($use_ttf) { // Select a random font size
|
if($use_ttf) { // Select a random font size
|
$font_size = mt_rand($min_size, $max_size);
| $font_size = my_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 = mt_rand($min_angle, $max_angle);
| $rotation = my_rand($min_angle, $max_angle);
|
// Set the colour
|
// Set the colour
|
$r = mt_rand(0, 200); $g = mt_rand(0, 200); $b = mt_rand(0, 200);
| $r = my_rand(0, 200); $g = my_rand(0, 200); $b = my_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 256 | Zeile 256 |
---|
}
// Draw a shadow
|
}
// Draw a shadow
|
$shadow_x = mt_rand(-3, 3) + $pos_x; $shadow_y = mt_rand(-3, 3) + $pos_y;
| $shadow_x = my_rand(-3, 3) + $pos_x; $shadow_y = my_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 272 | Zeile 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 + mt_rand(-3, 3);
| $pos_y = $img_height / 2 - $string_height -10 + my_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 288 | Zeile 288 |
---|
imagecolortransparent($temp_im, $bg_color);
// Set the colour
|
imagecolortransparent($temp_im, $bg_color);
// Set the colour
|
$r = mt_rand(0, 200); $g = mt_rand(0, 200); $b = mt_rand(0, 200);
| $r = my_rand(0, 200); $g = my_rand(0, 200); $b = my_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 = mt_rand(-1, 1); $shadow_y = mt_rand(-1, 1);
| $shadow_x = my_rand(-1, 1); $shadow_y = my_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);
|