source: extensions/CryptograPHP/securimage/securimage_preview.php @ 14634

Last change on this file since 14634 was 14527, checked in by mistic100, 13 years ago

update for 2.4
deactivated for smartpocket, now compatible with simple and stripped on ContactForm
live update of preview on admin page

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$temp_conf = array(
12  'captcha_type'    => $_GET['captcha_type'],
13  'width'           => (int)$_GET['width'], 
14  'height'          => (int)$_GET['height'],
15  'perturbation'    => (float)$_GET['perturbation'],
16  'image_bg_color'  => $_GET['image_bg_color'],
17  'code_length'     => (int)$_GET['code_length'],
18  'text_color'      => $_GET['text_color'],
19  'num_lines'       => (float)$_GET['num_lines'],
20  'line_color'      => $_GET['line_color'],
21  'noise_level'     => (float)$_GET['noise_level'],
22  'noise_color'     => $_GET['noise_color'],
23  'ttf_file'        => $_GET['ttf_file'],
24  );
25
26// randomize colors
27function randomColor()
28{
29  mt_srand((double)microtime()*1000000);
30  $c = null;
31  while(strlen($c)<6)
32  {
33      $c .= sprintf("%02X", mt_rand(0, 255));
34  }
35  return $c;
36}
37
38foreach (array('image_bg_color','text_color','line_color','noise_color') as $color)
39{
40  if ($temp_conf[$color] == 'random') $temp_conf[$color] = randomColor();
41}
42
43require_once dirname(__FILE__) . '/securimage.php';
44$img = new securimage();
45
46$img->ttf_file        = './fonts/'.$temp_conf['ttf_file'].'.ttf';
47$img->captcha_type    = ($temp_conf['captcha_type'] == 'string') ? Securimage::SI_CAPTCHA_STRING : Securimage::SI_CAPTCHA_MATHEMATIC;
48// $img->case_sensitive  = get_boolean($temp_conf['case_sensitive']);
49$img->image_width     = $temp_conf['width']; 
50$img->image_height    = $temp_conf['height'];
51$img->perturbation    = $temp_conf['perturbation'];
52$img->image_bg_color  = new Securimage_Color('#'.$temp_conf['image_bg_color']);
53$img->text_color      = new Securimage_Color('#'.$temp_conf['text_color']); 
54$img->num_lines       = $temp_conf['num_lines'];
55$img->line_color      = new Securimage_Color('#'.$temp_conf['line_color']);
56$img->noise_level     = $temp_conf['noise_level'];
57$img->noise_color     = new Securimage_Color('#'.$temp_conf['noise_color']);
58$img->code_length     = $temp_conf['code_length'];
59
60$img->show();
61
62?>
Note: See TracBrowser for help on using the repository browser.