Пример #1
0
<?php

session_start();
error_reporting(E_ALL ^ E_NOTICE);
require_once "captchalib.php";
header("Content-type: image/png");
$str = Get_Text();
$im = create_image();
draw_string($str, $im);
imagepng($im);
if ($CaseSenstive == true) {
    $_SESSION['pfw_text'] = md5($str);
} else {
    $str = strtolower($str);
    $_SESSION['pfw_text'] = md5($str);
}
Пример #2
0
imagefill($im, 0, 0, $bg_color);
// Draw random circles, squares or lines?
$to_draw = my_rand(0, 2);
if ($to_draw == 1) {
    draw_circles($im);
} else {
    if ($to_draw == 2) {
        draw_squares($im);
    } else {
        draw_lines($im);
    }
}
// Draw dots on the image
draw_dots($im);
// Write the image string to the image
draw_string($im, $imagestring);
// 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);
/**
 * Draws a random number of lines on the image.
 *
 * @param resource $im The image.
 */
function draw_lines(&$im)
{
    global $img_width, $img_height;