Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Gábor Papp
Added: May 2, 2021 5:18 AM
Views: 2
Tags: no tags
  1. .grecaptcha-badge {
  2.     width: 70px !important;
  3.     overflow: hidden !important;
  4.     transition: all 0.3s ease !important;
  5.     left: 0px !important;
  6.     bottom: 0px !important;
  7. }
  8.  
  9. <script src="https://www.google.com/recaptcha/api.js"></script>
  10.  
  11. <script language="JavaScript">
  12. function ellenorzes_es_kuldes(token) {
  13.     var hiba=false;
  14.  
  15.     f=document.urlap;
  16.     if (f.vezeteknev.value=='' ||
  17.         f.keresztnev.value=='' ||
  18.         f.emailcim.value=='' ||
  19.         f.telefonszam.value=='' ||
  20.         f.teszt_idopont.value=='' ||
  21.         f.jogositvany_ev.value=='' ||
  22.         f.milyen_motorok.value=='' ||
  23.         f.km_evente.value=='' ||
  24.         !f.adatkezeles_elfogadas.checked ||
  25.         !f.tesztvezetes_felteteleinek_elfogadas.checked) {
  26.         hiba=true;
  27.     }
  28.     if (hiba) {
  29.         alert('Minden *-gal jelölt mezőt ki kell tölteni!');
  30.         return false;
  31.     }
  32.  
  33.     document.getElementById("urlap").submit();
  34. }
  35. </script>
  36.  
  37. <button class="btn btn-success g-recaptcha"
  38. data-sitekey="6Lfp38EaAAAAANFwfY5rIXb2SUfS_G0nU13OFQ2A"
  39. data-callback='ellenorzes_es_kuldes'
  40. data-action='submit'>Küldés <i class="fa fa-paper-plane"></i></button>
  41.  
  42. $mehet=true;
  43. $verificationResponse=$_POST["g-recaptcha-response"];
  44. if( empty($verificationResponse) ) {
  45.     $mehet=false;
  46. }
  47. $response = recaptcha_readURL("https://www.google.com/recaptcha/api/siteverify?secret=6Lfp38EaAAAAAKzavx8_Yi8w3WtkGR1LqBlJplYb&response=".$verificationResponse."");
  48. $responseArray = json_decode($response, true);
  49. if( $responseArray["success"]!==true) {
  50.     $mehet=false;
  51. }
  52.  
  53. if ($mehet) {
  54. // .......
  55. }