You are here

function _captcha_update_captcha_session in CAPTCHA 8

Same name and namespace in other branches
  1. 6.2 captcha.inc \_captcha_update_captcha_session()
  2. 7 captcha.inc \_captcha_update_captcha_session()

Helper function for updating the solution in the CAPTCHA session table.

Parameters

string $captcha_sid: The CAPTCHA session ID to update.

string $solution: The new solution to associate with the given CAPTCHA session.

1 call to _captcha_update_captcha_session()
Captcha::preRenderProcess in src/Element/Captcha.php
Pre-render callback for additional processing of a CAPTCHA form element.

File

./captcha.inc, line 110
General CAPTCHA functionality and helper functions.

Code

function _captcha_update_captcha_session($captcha_sid, $solution) {
  \Drupal::database()
    ->update('captcha_sessions')
    ->condition('csid', $captcha_sid)
    ->fields([
    'timestamp' => \Drupal::time()
      ->getRequestTime(),
    'solution' => $solution,
  ])
    ->execute();
}