source: extensions/CryptograPHP/securimage/securimage_preview.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: 2.1 KB
Line 
1<?php
2/**
3 * this file take parameters from $_GET, reserved for admin usage
4 */
5 
6define('PHPWG_ROOT_PATH','../../../');
7include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
8
9if (!is_admin()) die('Hacking attempt!');
10
11
12$temp_conf = array(
13  'captcha_type'    => $_GET['captcha_type'],
14  'width'           => (int)$_GET['width'], 
15  'height'          => (int)$_GET['height'],
16  'perturbation'    => (float)$_GET['perturbation'],
17  'image_bg_color'  => $_GET['image_bg_color'],
18  'code_length'     => (int)$_GET['code_length'],
19  'text_color'      => $_GET['text_color'],
20  'num_lines'       => (float)$_GET['num_lines'],
21  'line_color'      => $_GET['line_color'],
22  'noise_level'     => (float)$_GET['noise_level'],
23  'noise_color'     => $_GET['noise_color'],
24  'ttf_file'        => $_GET['ttf_file'],
25  );
26
27 
28// randomize colors
29function randomColor()
30{
31  mt_srand((double)microtime()*1000000);
32  $c = null;
33  while(strlen($c)<6)
34  {
35      $c .= sprintf("%02X", mt_rand(0, 255));
36  }
37  return $c;
38}
39
40foreach (array('image_bg_color','text_color','line_color','noise_color') as $color)
41{
42  if ($temp_conf[$color] == 'random') $temp_conf[$color] = randomColor();
43}
44
45
46require_once dirname(__FILE__) . '/securimage.php';
47$img = new securimage();
48
49$img->ttf_file        = './fonts/'.$temp_conf['ttf_file'].'.ttf';
50$img->captcha_type    = ($temp_conf['captcha_type'] == 'string') ? Securimage::SI_CAPTCHA_STRING : Securimage::SI_CAPTCHA_MATHEMATIC;
51// $img->case_sensitive  = get_boolean($temp_conf['case_sensitive']);
52$img->image_width     = $temp_conf['width']; 
53$img->image_height    = $temp_conf['height'];
54$img->perturbation    = $temp_conf['perturbation'];
55$img->image_bg_color  = new Securimage_Color('#'.$temp_conf['image_bg_color']);
56$img->text_color      = new Securimage_Color('#'.$temp_conf['text_color']); 
57$img->num_lines       = $temp_conf['num_lines'];
58$img->line_color      = new Securimage_Color('#'.$temp_conf['line_color']);
59$img->noise_level     = $temp_conf['noise_level'];
60$img->noise_color     = new Securimage_Color('#'.$temp_conf['noise_color']);
61$img->code_length     = $temp_conf['code_length'];
62
63$img->show();
64
65?>
Note: See TracBrowser for help on using the repository browser.