form.ajax.php 666 B

123456789101112131415161718192021
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once __DIR__.'/../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']) ? '_HTML_QuickForm_CAPTCHA' : $_REQUEST['var'];
  9. if (isset($_SESSION[$sessionVar]) && !empty($_SESSION[$sessionVar])) {
  10. $obj = $_SESSION[$sessionVar];
  11. // Force a new CAPTCHA for each one displayed/** @var Text_CAPTCHA $obj */;
  12. $obj->generate(true);
  13. echo $image = $obj->getCAPTCHA();
  14. }
  15. exit;
  16. break;
  17. }