View Single Post
  #51  
Old 5th August 2018, 17:15
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
Quote:
Originally Posted by outtyrox View Post
Code:
<?php 

class TSUE_captcha
{
    public function verifyCaptcha($recaptcha_challenge_field = "", $recaptcha_response_field = "")
    {
                //
                //PUT YOUR PRIVATE KEY HERE//
                $secret = "6LcsM2gUAAAAAAjbvuAs-YtADTLyAKkG96AX8nmK";
                //
                //
                //
                $remoteip = $_SERVER["REMOTE_ADDR"];
                $url = "https://www.google.com/recaptcha/api/siteverify";
                $response = $_POST["g-recaptcha-response"];
         
                // Curl Request
                $curl = curl_init();
                curl_setopt($curl, CURLOPT_URL, $url);
                curl_setopt($curl, CURLOPT_POST, true);
                curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($curl, CURLOPT_POSTFIELDS, array(
                    'secret' => $secret,
                    'response' => $response,
                    'remoteip' => $remoteip
                    ));
                $curlData = curl_exec($curl);
                curl_close($curl);
         
                // Parse data
                $jsonResponse = json_decode($curlData);
                if ($jsonResponse->success === true)
                    return true;
                else
                    return false;
    }

}
problem here is
Code:
$response = $_POST["g-recaptcha-response"];
becuase you well not get that $_POST
you well need to use the
Code:
$recaptcha_response_field
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote