예제 #1
0
 public function actionCaptcha()
 {
     require_once dirname(__FILE__) . '/../widget/secureimage/assets/securimage.php';
     $img = new \Securimage();
     // You can customize the image by making changes below, some examples are included - remove the "//" to uncomment
     //$img->ttf_file        = dirname(__FILE__) . '/../widget/secureimage/assets/AHGBold.ttf';
     //$img->captcha_type    = \Securimage::SI_CAPTCHA_WORDS; // show a simple math problem instead of text
     //$img->case_sensitive  = true;                              // true to use case sensitve codes - not recommended
     //$img->image_height    = 90;                                // height in pixels of the image
     //$img->image_width     = $img->image_height * M_E *1.5;          // a good formula for image size based on the height
     //$img->perturbation    = .75;                               // 1.0 = high distortion, higher numbers = more distortion
     $img->image_bg_color = new \Securimage_Color("#f1f3f4");
     // image background color
     //$img->text_color      = new \Securimage_Color("#000");   // captcha text color
     //$img->num_lines       = 8;                                 // how many lines to draw over the image
     //$img->line_color      = new Securimage_Color("#0000CC");   // color of lines over the image
     //$img->image_type      = SI_IMAGE_JPEG;                     // render as a jpeg image
     //$img->signature_color = new Securimage_Color(rand(0, 64),
     //                                             rand(64, 128),
     //                                             rand(128, 255));  // random signature color
     if (!empty($_GET['namespace'])) {
         $img->setNamespace($_GET['namespace']);
     }
     $img->show();
 }
예제 #2
0
 public function securimages_play()
 {
     $options = array('use_database' => true, 'database_name' => '', 'database_user' => '', 'database_driver' => Securimage::SI_DRIVER_MYSQL);
     $img = new Securimage();
     // Other audio settings
     //$img->audio_use_sox   = true;
     //$img->audio_use_noise = true;
     //$img->degrade_audio   = false;
     //$img->sox_binary_path = 'sox';
     // To use an alternate language, uncomment the following and download the files from phpcaptcha.org
     // $img->audio_path = $img->securimage_path . '/audio/es/';
     // If you have more than one captcha on a page, one must use a custom namespace
     // $img->namespace = 'form2';
     // set namespace if supplied to script via HTTP GET
     if (!empty($_GET['namespace'])) {
         $img->setNamespace($_GET['namespace']);
     }
     return $img->outputAudioFile();
 }
예제 #3
0
 * If you found this script useful, please take a quick moment to rate it.<br />
 * http://www.hotscripts.com/rate/49400.html  Thanks.
 *
 * @link http://www.phpcaptcha.org Securimage PHP CAPTCHA
 * @link http://www.phpcaptcha.org/latest.zip Download Latest Version
 * @link http://www.phpcaptcha.org/Securimage_Docs/ Online Documentation
 * @copyright 2012 Drew Phillips
 * @author Drew Phillips <*****@*****.**>
 * @version 3.5.2 (Feb 15, 2014)
 * @package Securimage
 *
 */
require_once dirname(__FILE__) . '/securimage.php';
// if using database, adjust these options as necessary and change $img = new Securimage(); to $img = new Securimage($options);
// see test.mysql.php or test.sqlite.php for examples
$options = array('use_database' => true, 'database_name' => '', 'database_user' => '', 'database_driver' => Securimage::SI_DRIVER_MYSQL);
$img = new Securimage();
// Other audio settings
//$img->audio_use_sox   = true;
//$img->audio_use_noise = true;
//$img->degrade_audio   = false;
//$img->sox_binary_path = 'sox';
// To use an alternate language, uncomment the following and download the files from phpcaptcha.org
// $img->audio_path = $img->securimage_path . '/audio/es/';
// If you have more than one captcha on a page, one must use a custom namespace
// $img->namespace = 'form2';
// set namespace if supplied to script via HTTP GET
if (!empty($_GET['namespace'])) {
    $img->setNamespace($_GET['namespace']);
}
$img->outputAudioFile();
예제 #4
0
$img = new Securimage();

// You can customize the image by making changes below, some examples are included - remove the "//" to uncomment

//$img->ttf_file        = './Quiff.ttf';
//$img->captcha_type    = Securimage::SI_CAPTCHA_MATHEMATIC; // show a simple math problem instead of text
//$img->case_sensitive  = true;                              // true to use case sensitve codes - not recommended
//$img->image_height    = 90;                                // height in pixels of the image
//$img->image_width     = $img->image_height * M_E;          // a good formula for image size based on the height
//$img->perturbation    = .75;                               // 1.0 = high distortion, higher numbers = more distortion
//$img->image_bg_color  = new Securimage_Color("#0099CC");   // image background color
//$img->text_color      = new Securimage_Color("#EAEAEA");   // captcha text color
//$img->num_lines       = 8;                                 // how many lines to draw over the image
//$img->line_color      = new Securimage_Color("#0000CC");   // color of lines over the image
//$img->image_type      = SI_IMAGE_JPEG;                     // render as a jpeg image
//$img->signature_color = new Securimage_Color(rand(0, 64),
//                                             rand(64, 128),
//                                             rand(128, 255));  // random signature color

// see securimage.php for more options that can be set

// set namespace if supplied to script via HTTP GET
if (!empty($_GET['namespace'])) $img->setNamespace($_GET['namespace']);

$img->image_signature = 'Bank of Muenchen';
$img->signature_color = new Securimage_Color('#0066FF');
$img->show();  // outputs the image and content headers to the browser
// alternate use:
// $img->show('/path/to/background_image.jpg');
 public static function isValid($captcha_name, $code_captcha)
 {
     $img = new Securimage();
     $img->setNamespace($captcha_name);
     return $img->check($code_captcha);
 }
예제 #6
0
// Register route for captcha image generation
kirby()->routes(array(array('pattern' => 'captcha', 'action' => function () {
    $img = new Securimage();
    $img->case_sensitive = c::get('captcha.case_sensitive', true);
    $img->perturbation = c::get('captcha.perturbation', 0.75);
    $img->num_lines = c::get('captcha.num_lines', 8);
    $img->charset = c::get('captcha.charset', 'ABCDEFGHJKMNPQRSTVWXYZ');
    if (c::get('captcha.ttf_file')) {
        $img->ttf_file = c::get('captcha.ttf_file');
    }
    if (c::get('captcha.height')) {
        $img->image_height = c::get('captcha.height');
    }
    if (c::get('captcha.width')) {
        $img->image_width = c::get('captcha.width');
    }
    if (c::get('captcha.bg_color')) {
        $img->image_bg_color = new Securimage_Color(c::get('captcha.bg_color'));
    }
    if (c::get('captcha.text_color')) {
        $img->text_color = new Securimage_Color(c::get('captcha.text_color'));
    }
    if (c::get('captcha.line_color')) {
        $img->line_color = new Securimage_Color(c::get('captcha.line_color'));
    }
    if (get('namespace')) {
        $img->setNamespace(get('namespace'));
    }
    $img->show();
    return false;
})));