source: extensions/CryptograPHP/securimage/securimage_show.php @ 23209

Last change on this file since 23209 was 19428, checked in by mistic100, 11 years ago

change reload icon with color choice (dark or light), separate HTML and PHP

File size: 3.6 KB
Line 
1<?php
2/**
3 * Project:     Securimage: A PHP class for creating and managing form CAPTCHA images
4 * File:        securimage_show.php
5 *
6 * Copyright (c) 2011, Drew Phillips
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without modification,
10 * are permitted provided that the following conditions are met:
11 *
12 *  - Redistributions of source code must retain the above copyright notice,
13 *    this list of conditions and the following disclaimer.
14 *  - Redistributions in binary form must reproduce the above copyright notice,
15 *    this list of conditions and the following disclaimer in the documentation
16 *    and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 *
30 * Any modifications to the library should be indicated clearly in the source code
31 * to inform users that the changes are not a part of the original software.
32 *
33 * If you found this script useful, please take a quick moment to rate it.
34 * http://www.hotscripts.com/rate/49400.html  Thanks.
35 *
36 * @link http://www.phpcaptcha.org Securimage PHP CAPTCHA
37 * @link http://www.phpcaptcha.org/latest.zip Download Latest Version
38 * @link http://www.phpcaptcha.org/Securimage_Docs/ Online Documentation
39 * @copyright 2011 Drew Phillips
40 * @author Drew Phillips <drew@drew-phillips.com>
41 * @version 3.0 (October 2011)
42 * @package Securimage
43 *
44 */
45
46define('PHPWG_ROOT_PATH','../../../');
47include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
48
49
50// randomize colors
51function randomColor()
52{
53  mt_srand((double)microtime()*1000000);
54  $c = null;
55  while(strlen($c)<6)
56  {
57      $c .= sprintf("%02X", mt_rand(0, 255));
58  }
59  return $c;
60}
61
62foreach (array('image_bg_color','text_color','line_color','noise_color') as $color)
63{
64  if ($conf['cryptographp'][$color] == 'random') $conf['cryptographp'][$color] = randomColor();
65}
66
67
68require_once dirname(__FILE__) . '/securimage.php';
69$img = new securimage();
70
71$img->ttf_file        = './fonts/'.$conf['cryptographp']['ttf_file'].'.ttf';
72$img->captcha_type    = ($conf['cryptographp']['captcha_type'] == 'string') ? Securimage::SI_CAPTCHA_STRING : Securimage::SI_CAPTCHA_MATHEMATIC;
73// $img->case_sensitive  = get_boolean($conf['cryptographp']['case_sensitive']);
74$img->image_width     = $conf['cryptographp']['width']; 
75$img->image_height    = $conf['cryptographp']['height'];
76$img->perturbation    = $conf['cryptographp']['perturbation'];
77$img->image_bg_color  = new Securimage_Color('#'.$conf['cryptographp']['image_bg_color']);
78$img->text_color      = new Securimage_Color('#'.$conf['cryptographp']['text_color']); 
79$img->num_lines       = $conf['cryptographp']['num_lines'];
80$img->line_color      = new Securimage_Color('#'.$conf['cryptographp']['line_color']);
81$img->noise_level     = $conf['cryptographp']['noise_level'];
82$img->noise_color     = new Securimage_Color('#'.$conf['cryptographp']['noise_color']);
83$img->code_length     = $conf['cryptographp']['code_length'];
84
85$img->show();
86
87?>
Note: See TracBrowser for help on using the repository browser.