XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
text.php
Go to the documentation of this file.
1 <?php
20 defined('XOOPS_ROOT_PATH') or die('Restricted access');
21 
23 {
29  function render()
30  {
31  $form = $this->loadText() . '&nbsp;&nbsp; <input type="text" name="' . $this->config['name'] . '" id="' . $this->config['name'] . '" size="' . $this->config['num_chars'] . '" maxlength="' . $this->config['num_chars'] . '" value="" />';
32  $form .= '<br />' . _CAPTCHA_RULE_TEXT;
33  if (!empty($this->config['maxattempts'])) {
34  $form .= '<br />' . sprintf(_CAPTCHA_MAXATTEMPTS, $this->config['maxattempts']);
35  }
36  return $form;
37  }
38 
44  function loadText()
45  {
46  $val_a = rand(0, 9);
47  $val_b = rand(0, 9);
48  if ($val_a > $val_b) {
49  $expression = "{$val_a} - {$val_b} = ?";
50  $this->code = $val_a - $val_b;
51  } else {
52  $expression = "{$val_a} + {$val_b} = ?";
53  $this->code = $val_a + $val_b;
54  }
55  return '<span style="font-style: normal; font-weight: bold; font-size: 100%; font-color: #333; border: 1px solid #333; padding: 1px 5px;">'.$expression.'</span>';
56  }
57 }
58 
59 ?>