You are here

public static function CleantalkFuncs::_cleantalk_apbct_cookies_test in Anti Spam by CleanTalk 7.5

Same name and namespace in other branches
  1. 7.4 src/CleantalkFuncs.php \CleantalkFuncs::_cleantalk_apbct_cookies_test()

Cookie test

Return value

int 1|0

2 calls to CleantalkFuncs::_cleantalk_apbct_cookies_test()
CleantalkFuncs::_cleantalk_check_spam in src/CleantalkFuncs.php
Cleantalk inner function - performs antispam checking.
CleantalkFuncs::_cleantalk_get_submit_time in src/CleantalkFuncs.php

File

src/CleantalkFuncs.php, line 177

Class

CleantalkFuncs
Cleantalk class create request

Code

public static function _cleantalk_apbct_cookies_test() {
  if (variable_get('cleantalk_alternative_cookies_session', 0)) {
    return 1;
  }
  $cookie_test = json_decode(stripslashes(self::_apbct_getcookie('apbct_cookies_test')), true);
  if (is_null($cookie_test)) {
    return null;
  }
  $check_string = trim(variable_get('cleantalk_authkey', ''));
  foreach ($cookie_test['cookies_names'] as $cookie_name) {
    $check_string .= self::_apbct_getcookie($cookie_name);
  }
  unset($cokie_name);
  if ($cookie_test['check_value'] == md5($check_string)) {
    return 1;
  }
  else {
    return 0;
  }
}