<commit_before><?php

/**
 * Valideert de stem.
 *
 * @author omniscimus
 */
class Vote_Validator {

    /**
     * Geeft of de uitgebrachte stem geldig is.
     * 
     * @return true als de stem geldig is; anders false
     */
    function vote_is_valid($g_recaptcha_response) {
        // Check if it isn't a proxy or Tor
        if (!$this->is_detectable_proxy() && !$this->is_tor_exit_node()) {
            // Check captcha
            if ($this->captcha_is_valid($g_recaptcha_response)) {
                // Check if the IP has already voted
                // Check if they don't have a cookie
            }
        }
    }

    /**
     * Geeft of de ingevulde Google reCAPTCHA geldig is.
     * 
     * @param string $g_recaptcha_response de POST resultaten van de reCAPTCHA
     * @return boolean true als de reCAPTCHA geldig is; anders false
     */
    private function captcha_is_valid($g_recaptcha_response) {
        $config = include 'config.php';
        $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $config["secret-key"] . "&response=" . $g_recaptcha_response);
        $decoded_response = json_decode($response, true);
        return $decoded_response["success"];
    }
<commit_msg>Use POST instead of GET for reCAPTCHA<commit_after><?php

/**
 * Valideert de stem.
 *
 * @author omniscimus
 */
class Vote_Validator {

    /**
     * Geeft of de uitgebrachte stem geldig is.
     * 
     * @return true als de stem geldig is; anders false
     */
    function vote_is_valid($g_recaptcha_response) {
        // Check if it isn't a proxy or Tor
        if (!$this->is_detectable_proxy() && !$this->is_tor_exit_node()) {
            // Check captcha
            if ($this->captcha_is_valid($g_recaptcha_response)) {
                // Check if the IP has already voted
                // Check if they don't have a cookie
            }
        }
    }

    /**
     * Geeft of de ingevulde Google reCAPTCHA geldig is.
     * 
     * @param string $g_recaptcha_response de POST resultaten van de reCAPTCHA
     * @return boolean true als de reCAPTCHA geldig is; anders false
     */
    private function captcha_is_valid($g_recaptcha_response) {
        $config = include 'config.php';
        $data = array('secret' => $config["secret-key"], 'response' => $g_recaptcha_response);
        $url = "https://www.google.com/recaptcha/api/siteverify";
        $options = array(
            'http' => array(
                'header' => "Content-type: application/x-www-form-urlencoded\r\n",
                'method' => 'POST',
                'content' => http_build_query($data),
            ),
        );
        $context = stream_context_create($options);
        $response = file_get_contents($url, false, $context);
        $decoded_response = json_decode($response, true);
        return $decoded_response["success"];
    }

{'fraction_non_alphanumeric': 0.11719833564493759, 'fraction_numerical': 0.0, 'mean_word_length': 2.2525366403607667, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5678053', 'n_tokens_mistral': 902, 'n_tokens_neox': 882, 'n_words': 221}