Sample CAPTCHA page code
<?php
//Init CAPTCHA Variables
include 'ss2.php';//path to ss2 php file
$siteKey="your-sitekey-goes-here";//Enter your sitekey obtained from reCaptcha Vebsite
$secret="your-s3cr3t-key-goes-here";// Enter your secret key obtained from reCaptcha Vebsite
$lang ='en';//Language of website here -- See Google's ReCAPTCHA V2 for options?><!--The GET Request CAPTCHA PAGE (StylesandIncludes)--><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>ShieldSquare reCAPTCHA Page</title><link rel="shortcut icon" href="https://cdn.perfdrive.com/icons/favicon.png" type="image/x-icon"/><style type="text/css">
body {
margin:1em5em05em;
font-family: sans-serif;}
fieldset {
display:inline;
padding:1em;}</style></head><body align="center"><a href="//www.shieldsquare.com" target="_blank"><img src="https://cdn.perfdrive.com/icons/shieldsquarelogo.png"></a><hr><h1>SuspiciousActivityDetected</h1><?php
//making a call to Shieldsquare server that CAPTCHA is shown
$shieldsquare_userid ="";// Enter the UserID of the user
$shieldsquare_calltype =4;
$shieldsquare_response = shieldsquare_ValidateRequest($shieldsquare_userid, $shieldsquare_calltype);?><?php
if(isset($_POST['g-recaptcha-response'])){
$response = getCurlData("https://www.google.com/recaptcha/api/siteverify?secret=".$secret."&response=".$_POST['g-recaptcha-response']);
$response = json_decode($response,true);if($response["success"]===true){
$redirPage = $_COOKIE["currentPagename"];
setcookie(md5("captchaResponse"),md5("1".$redirPage.$_SERVER[$shieldsquare_config_data->_ipaddress].$shieldsquare_config_data->_sid),time()+60*60,"/");
header("Location:".$redirPage);exit();}else{
header("Location:".$_SERVER["PHP_SELF"]);exit();}}?><!--TheFormDisplay--You can Customizethis form forYourself!--><p>Complete the reCAPTCHA then submit the form.</p><fieldset><legend>SolveCaptcha</legend><form action="<?php $_SERVER['PHP_SELF']; ?>" method=POST><div class="g-recaptcha" data-sitekey="<?php echo $siteKey; ?>"></div><script type="text/javascript"
src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang; ?>"></script><br><input type=SubmitValue="GO"/></fieldset></form><br><br><br><br><hr><br><footer><small>©Copyright2015,AllRightsReserved.KaalbiTechnologiesPvt.Ltd.</small></footer></body></html><?php
function getCurlData($url){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl, CURLOPT_TIMEOUT,10);
curl_setopt($curl, CURLOPT_USERAGENT,"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16");
$curlData = curl_exec($curl);
curl_close($curl);return $curlData;}?>
|