Pages

Using Google No captcha Re captcha in your web page 2016

<?php

if(isset($_POST['submit']))
{
$secret = "XXXXXXXXXXXXXXXXXXXXX"; //secret key

$response = $_POST['g-recaptcha-response']; // captcha response

$remoteip = $_SERVER['REMOTE_ADDR']; // get user ip

$url = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=$response&remoteip=$remoteip"); // pass values to recapcha API

$result = json_decode($url, TRUE);

if($result['success']==1)
{
echo "SUCCESS"
}
else{
echo "failed"
}

}

bootstrap change active tab on page reload

  <script>
  $('.nav-tabs-custom a').click(function(e) {
  e.preventDefault();
  $(this).tab('show');
});

// store the currently selected tab in the hash value
$("ul.nav-tabs > li > a").on("shown.bs.tab", function(e) {
  var id = $(e.target).attr("href").substr(1);
  window.location.hash = id;
});

// on load of the page: switch to the currently selected tab
var hash = window.location.hash;
$('.nav-tabs-custom a[href="' + hash + '"]').tab('show');
  </script>

Search This Blog