form.ajax.php 668 B

123456789101112131415161718192021222324
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. //require_once '../global.inc.php';
  4. $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null;
  5. switch ($action) {
  6. case 'get_captcha':
  7. header('Content-Type: image/jpeg');
  8. $sessionVar = (empty($_REQUEST['var']))
  9. ? '_HTML_QuickForm_CAPTCHA'
  10. : $_REQUEST['var'];
  11. // Force a new CAPTCHA for each one displayed
  12. /** @var Text_CAPTCHA $obj */
  13. $obj = $_SESSION[$sessionVar];
  14. $obj->generate(true);
  15. echo $image = $obj->getCAPTCHA();
  16. //echo $_SESSION[$sessionVar]->getCAPTCHAAsJPEG();
  17. exit;
  18. break;
  19. }