Ejemplo n.º 1
0
function siteaccess_code_page_handler($page)
{
    $valid_pages = array('code');
    if (empty($page[0]) || !in_array($page[0], $valid_pages)) {
        forward('', '404');
    }
    switch ($page[0]) {
        case "code":
            $tmp = get_input('c');
            $code = siteaccess_generate_captcha($tmp);
            $images_path = dirname(__FILE__) . '/images';
            $image = ImageCreateFromJPEG("{$images_path}/code.jpg");
            $text_color = ImageColorAllocate($image, 80, 80, 80);
            Header("Content-type: image/jpeg");
            ImageString($image, 5, 12, 2, $code, $text_color);
            ImageJPEG($image, NULL, 75);
            ImageDestroy($image);
            die;
            break;
        default:
            break;
    }
    return true;
}
Ejemplo n.º 2
0
<?php

global $CONFIG;
$tmp = get_input('c');
$code = siteaccess_generate_captcha($tmp);
$image = ImageCreateFromJPEG($CONFIG->pluginspath . "/siteaccess/images/code.jpg");
$text_color = ImageColorAllocate($image, 80, 80, 80);
Header("Content-type: image/jpeg");
ImageString($image, 5, 12, 2, $code, $text_color);
ImageJPEG($image, '', 75);
ImageDestroy($image);
die;