src/HiddenCaptcha.php
public static function check(Validator $validator, $minLimit = 0, $maxLimit = 1200)
    {
        $formData = $validator->getData();

        // Check post values
        if (!isset($formData['_captcha']) || !($token = self::getToken($formData['_captcha']))) {
            return false;
        }

        // Hidden "must be empty" field check
        if (!array_key_exists($token['must_be_empty'], $formData) || !empty($formData[$token['must_be_empty']])) {
            return false;
        }

        // Check time limits
        $now = time();
        if ($now - $token['timestamp'] < $minLimit || $now - $token['timestamp'] > $maxLimit) {
            return false;
        }

        // Check the random posted field
        if (empty($formData[$token['random_field_name']])) {
            return false;
        }

        // Check if the random field value is similar to the token value
        $randomField = $formData[$token['random_field_name']];
        if (!ctype_digit($randomField) || $token['timestamp'] != $randomField) {
            return false;
        }

        // Everything is ok, return true
        return true;
    }
public static function check(Validator $validator, $minLimit = 0, $maxLimit = 1200)
    {
        $formData = $validator->getData();

        // Check post values
        if (!isset($formData['_captcha']) || !($token = self::getToken($formData['_captcha']))) {
            return false;
        }

        // Hidden "must be empty" field check
        if (!array_key_exists($token['must_be_empty'], $formData) || !empty($formData[$token['must_be_empty']])) {
            return false;
        }

        // Check time limits
        $now = time();
        if ($now - $token['timestamp'] < $minLimit || $now - $token['timestamp'] > $maxLimit) {
            return false;
        }

        // Check the random posted field
        if (empty($formData[$token['random_field_name']])) {
            return false;
        }

        // Check if the random field value is similar to the token value
        $randomField = $formData[$token['random_field_name']];
        if (!ctype_digit($randomField) || $token['timestamp'] != $randomField) {
            return false;
        }

        // Everything is ok, return true
        return true;
    }
public static function check ( Validator $ validator , $ minLimit = 0 , $ maxLimit = 1200 ) { $ formData = $ validator -> getData ( ) ; // Check post values if ( ! isset ( $ formData [ '_captcha' ] ) || ! ( $ token = self :: getToken ( $ formData [ '_captcha' ] ) ) ) { return false ; } // Hidden "must be empty" field check if ( ! array_key_exists ( $ token [ 'must_be_empty' ] , $ formData ) || ! empty ( $ formData [ $ token [ 'must_be_empty' ] ] ) ) { return false ; } // Check time limits $ now = time ( ) ; if ( $ now - $ token [ 'timestamp' ] < $ minLimit || $ now - $ token [ 'timestamp' ] > $ maxLimit ) { return false ; } // Check the random posted field if ( empty ( $ formData [ $ token [ 'random_field_name' ] ] ) ) { return false ; } // Check if the random field value is similar to the token value $ randomField = $ formData [ $ token [ 'random_field_name' ] ] ; if ( ! ctype_digit ( $ randomField ) || $ token [ 'timestamp' ] != $ randomField ) { return false ; } // Everything is ok, return true return true ; }
Check the hidden captcha values.

@param Validator $validator
@param int       $minLimit
@param int       $maxLimit

@return bool
Check the hidden captcha values .