PHP Tutorial For Beginners: Google reCAPTCHA v2

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024

Комментарии • 278

  • @helloitsjury
    @helloitsjury 5 лет назад +3

    You are the only guy who explains this properly. THANK YOU SO MUCH

  • @mirmil11
    @mirmil11 6 дней назад

    This is the best tutorial on this topic. Precise and crystal clear information delivered with good and clear English diction. Thank you Senaid.

  • @Fonzzzzzii
    @Fonzzzzzii 6 лет назад +1

    I added a reCAPTCHA v2 to my event registration website but I didn't tie it with Google, thinking that disabling the submit button until the reCAPTCHA was checked would be enough. I was wrong. Once my website went public, I got a flood of people registering for the event. Things were smooth for the first two days, however, on the third day some idiot had a robot register fake participants to my event. It was so bad. I was getting around one new registration every three to five seconds. I found your video and quickly implemented the fix by connecting the reCAPCHA with Google. Suddenly I stopped getting fake registrations. I did a quick registration test to make sure that registration was still working, and thankfully it was. Your video saved my event! Thank you!

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      I am sorry that you had such a bad experience, but glad that my video could help.

  • @noeljose
    @noeljose 5 лет назад +4

    I saw almost all your videos on php, you deserves a great salute. thank you brother

  • @dissonancia_cognitiva
    @dissonancia_cognitiva 5 лет назад +8

    Simples, prático e objetivo. Único tutorial que realmente valeu a pena assistir, parabéns!!!!

  • @weshuiz1325
    @weshuiz1325 4 года назад

    well finnaly somebody who explain's it instead of just saying *copy the code from the link below*
    btw tip for you guy's who are starting to learn php or have few knowlege about it
    $username = htmlspecialchars(strip_tags($_POST['username']); if you actuely want it to be secure

  • @EVOAXL
    @EVOAXL 3 года назад

    I was struggling to implement reCAPTCHA V2 and you provided a simple and well explained solution, thank you very much!

  • @dammyadonis8840
    @dammyadonis8840 4 года назад

    i honestly don't have a choice other than to like this video, it's great
    thank you

  • @NightcoreBlast
    @NightcoreBlast 5 лет назад +1

    wonderful! everything else was failing for me and this is the only one that worked, not only that, but it was all simple!

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад +1

      Glad I could help, thank you for the feedback :)

  • @collinstubblefield5596
    @collinstubblefield5596 7 лет назад +2

    Thank you so much. You totally rock. I wouldn't have figured it out on my own.

    • @SenaidBacinovic
      @SenaidBacinovic  7 лет назад

      Thank you so much! Appreciate the feedback and support. :)

  • @kennethwood9200
    @kennethwood9200 6 лет назад +1

    Thanks! Finally a simple implementation that works without adding any complexity!

  • @TyZo
    @TyZo 5 лет назад +2

    Thank you for this Senaid! I wish google provided better documentation for setting up reCAPTCHA. You are a life saver!

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      My pleasure, glad you like it!

    • @topnetworkersgroup
      @topnetworkersgroup 5 лет назад +1

      i agree; just got here and hope this video helps me out; the documentation by google is TRASH .....

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      @@topnetworkersgroup did you find it useful?

    • @topnetworkersgroup
      @topnetworkersgroup 5 лет назад

      @@SenaidBacinovic hey thanks for responding; I actually 'put it off' until a few moments ago. I figured some of the code you had I didn't need; and it didn't work at first; I ended up removing the extra code and 'mistakenly' discovered that just putting the api.js in the Head area 'seems' to be enough ......... going to update a few more codes and see if the theory is right; maybe googles 'simple documentation' is enough afterall; thanks for this tutorial however!!

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      @@topnetworkersgroup Hmm, that is interesting. After all, it all depends on your entire project structure, and maybe you need to make a few changes in order to be able to use it.

  • @PixelHamster
    @PixelHamster 5 лет назад +2

    according to the reCaptcha docs you have to use a post request to verify a user

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      Yes, they said that in docs, but it will work with both. :)

  • @SRHartley
    @SRHartley Год назад

    My v2 reCAPTCHA v2 works on my test server, localhost, and partially on my live domain. On the live domain, I get the green tick after selecting the correct images in the Captcha, however, when I press the Save button I receive the message 'Verfication Failed'. I have added both domains to the list of domains in the v2 settings. Any ideas?

  • @robertjb6543
    @robertjb6543 3 года назад

    The one MAIN thing Sir your NOT checking for is what if someone leaves a field empty but they still check the ReCaptcha? What error are they going to get or will the ReCaptcha still work?

  • @igortorga5396
    @igortorga5396 5 лет назад

    meu filho vc fez o impossivel, pq foi o unico video que assistir que realmente funcionou, parabens pelo trabalho ai, esta melhor que muita documentação por ai! Obrigado e excelente trabalho.

  • @bedrockmace840
    @bedrockmace840 6 лет назад

    I have a very troubled problem reCAPTCHA security validation I have to go out to confirm when I go to a site but I do not go out to confirm it on any site and I can not sign up or I can not enter the sites I get confirmation on the laptop but not on the PC please try every way I uploaded my dlls and tried different browsers. I tried the combofix. I did not try adw. I do not want to format the mmm: /

  • @fahadhafeez8086
    @fahadhafeez8086 4 года назад +1

    Thanks man! it helps a lot

  • @ivanbazan8421
    @ivanbazan8421 5 лет назад +1

    A very simple and easy to understand explanation. Thanks!

  • @nazububu
    @nazububu 6 лет назад +1

    A good lesson. Everything is clear and simple. Thank.

  • @collettebarber2409
    @collettebarber2409 3 года назад

    I've been really struggling to implement this. So will start again following your code.

  • @arifrkextras7215
    @arifrkextras7215 4 года назад +1

    Thank you so much sir
    you are the HERO sir

  • @charleswilliams8368
    @charleswilliams8368 6 лет назад

    I watched this a couple of times and was able to implement it. Thanks.

  • @dennis6135
    @dennis6135 5 лет назад +3

    Thanks man, this is great! worked first try, great explanation. Subbed :)

  • @projectpeanut8057
    @projectpeanut8057 5 лет назад

    Hello Senaid,
    I have a question... do I need to do something different if i am submitting my form with ajax? because at the moment i am doing my implementation exactly as shown in this video. and I get the error that says something along the lines "missing-response-input" so i am guessing this has to do with the fact that all the other values from the form get passed through ajax except for the captcha field. I don't think this field exists in the send() method if not specified by me right? so this might work with posting a form traditionally using names but otherwise no... or am i wrong?

  • @posinfo
    @posinfo 6 лет назад

    Hi, can I use curl to get some data from a website with this google reCaptcha?

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      Not sure what do you mean, can you elaborate on that?

  • @0zec
    @0zec 6 лет назад +1

    thanks bra , at last clean and simple lesson. Works like a charm

  • @mubashirhasan2329
    @mubashirhasan2329 5 лет назад +1

    thanks brother

  • @expertcoder3101
    @expertcoder3101 3 года назад

    Sir many many thanks :) Helped me this video...

  • @manavshah2119
    @manavshah2119 4 года назад

    Sir is Nice Video to integrated reCAPTCHA to PHP localhost

  • @irvanfansuri6636
    @irvanfansuri6636 5 лет назад +1

    Thanks bro! Nice tutorial, very simple and easy to understand. You're amazing

  • @joaopaulocruzrosa5368
    @joaopaulocruzrosa5368 5 лет назад +2

    I'm getting the "verification failed" msg even when I check the recaptcha? Why is it not working! Pls

    • @nortski78
      @nortski78 4 года назад

      Same, just can't get this to work. So frustrating.

  • @bringit_bruh6327
    @bringit_bruh6327 7 лет назад +9

    Due to the high quality content on your channel i have decided to subscribe :)

    • @SenaidBacinovic
      @SenaidBacinovic  7 лет назад

      LoL! Thank you for that comment and for subscribing too! You're amazing. :)

    • @YOYOSHIVA
      @YOYOSHIVA 6 лет назад +1

      im shocked to see 4k res for a tech vid ...most generous coder out there ..big thumps up from my otherwise tiring eyes

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      @@YOYOSHIVA Somehow I have missed your comment... thank you! :)

  • @jorgesantanna3518
    @jorgesantanna3518 4 года назад

    Grato. Me ajudou bastante.

  • @those1kidds
    @those1kidds 7 лет назад +1

    Thank you much, it's ridiculous Google doesn't have something like this in their documentation. Makes it basically impossible to figure something like this out unless you're a PHP dev.

    • @SenaidBacinovic
      @SenaidBacinovic  7 лет назад

      those1kidds I agree, the documentation is not that good for most of the things.

    • @those1kidds
      @those1kidds 7 лет назад +1

      Coding Passive Income how did you figure it out? Are you just that amazing? (:

    • @SenaidBacinovic
      @SenaidBacinovic  7 лет назад

      Ohh, thank you so much for nice words! :)

  • @odunladeoluwaseun7880
    @odunladeoluwaseun7880 5 лет назад

    sir I keep getting invalid input response. could it be because I use ajax with my form? do I need to pass recaptcha code with ajax from my form? how do I do that? thank you

  • @danielmarques2350
    @danielmarques2350 7 лет назад +2

    You helped me a lot. Thanks!

    • @SenaidBacinovic
      @SenaidBacinovic  7 лет назад

      Daniel Marques it's my pleasure, thank you for the feedback :)

  • @TheEmperor000
    @TheEmperor000 5 лет назад +2

    9:22 -> "And now if I try again and hit I'm not a robot"... who are you trying to fool, Senaid? :D
    Your videos are awesome! Many thanks!

  • @gaurishukla9177
    @gaurishukla9177 6 лет назад +1

    You have solution to all my problems... subscribed :)

  • @kiriloffice
    @kiriloffice 6 лет назад +1

    great tutorial just made it on my website, thanks :)

  • @emilyyang2126
    @emilyyang2126 6 лет назад

    got the problem of Trying to get property of non-object in C:\wamp64\www\DB_final-master\login\try.php on line 47 which
    45: $response = file_get_contents($url);
    46: $response = json_decode($response);
    47: if ($response->success)
    please help me

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      Have you tried to check what do you have in $response after line 45? Maybe you get nothing from that $url.

  • @bhavinrathod5065
    @bhavinrathod5065 6 лет назад +1

    You helped me lot , Thank you very much for this tutorial

  • @wrzq
    @wrzq 5 лет назад +1

    Thank you very much for this tutorial.

  • @disskettenfett3599
    @disskettenfett3599 5 лет назад +1

    Thank you, you helped me a lot with your video. :)

  • @jvt3057
    @jvt3057 4 года назад

    just saw your vid the first 2 sec, I already love the accent and everything. instantly liked the video, now lets watch it. :P

  • @moizkhalid2714
    @moizkhalid2714 5 лет назад +1

    So impress by this video

  • @aarnbee1693
    @aarnbee1693 3 года назад

    thank you

  • @iamgauravdaware
    @iamgauravdaware 6 лет назад +1

    Really appreciate for making this video....

  • @pianoLee-sx9dx
    @pianoLee-sx9dx 5 лет назад

    Must the secret key be in single or double quotes? I got it to work by putting a double quote for the $url but why is it in double quote?

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      It doesn't matter, but you need to know how to use single/double quotes properly.
      Example: Let's imagine we have one variable: $number = 1;
      * echo 'number = $number'; ----> OUTPUT: number = $number
      * echo "number = $number"; -----> OUTPUT: number = 1
      * echo 'number = ' . $number; -----> OUTPUT: number = 1
      So, in conclusion it means that if you're using variable inside single quotes, it will actually only display the variable and not the data inside the variable, which with double quotes it will work as expected. Hope this helps.

  • @shalinnipuna440
    @shalinnipuna440 5 лет назад +1

    helped a lot. Thanks man

  • @inmortal009
    @inmortal009 6 лет назад

    Thank you, you made this look so easy it's incredible

  • @thebestken
    @thebestken 2 года назад

    Why it showing recaptcha every time on postback when it has verified the user. I think it should be hidden if user proved to be valid human.

  • @RicardoRamirez-kb8ib
    @RicardoRamirez-kb8ib 5 лет назад +1

    Solid tutorial! Thanks for the video!

  • @mdhabib-xf1dc
    @mdhabib-xf1dc 7 лет назад +1

    Thank you sir i have learn more things buz of you ,plz u can upload video for like and comment process how to work with jquery

    • @SenaidBacinovic
      @SenaidBacinovic  7 лет назад

      Thank you so much! Can you please give me a little bit more information on what you are trying to achieve?

  • @AlexandruStefan
    @AlexandruStefan 6 лет назад +2

    Hello! I had troubles using your example and many others' examples. Finally, I found out why. And my solution could help a lot of people having the same problem as me. Your example uses file_get_contents. On many shared hosts, your example won't work because of that. So I tried with cURL instead and finally got it to work. Can I post here the curl example? Very easy to implement and could help other people. You could also offer that as an alternative code for those having problems with file_get_contents.

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      Thank you for sharing it with us, didn't know that. Absolutely, feel free to post code and help others that have a similar problem. :)

    • @AlexandruStefan
      @AlexandruStefan 6 лет назад +1

      $post_data = "secret=YOURSECRETKEYHERE&response=".$_POST['g-recaptcha-response']."&remoteip=".$_SERVER['REMOTE_ADDR'] ;
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, "www.google.com/recaptcha/api/siteverify");
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_HTTPHEADER,
      array('Content-Type: application/x-www-form-urlencoded; charset=utf-8',
      'Content-Length: ' . strlen($post_data)));
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
      $googresp = curl_exec($ch);
      $decgoogresp = json_decode($googresp);
      curl_close($ch);
      if ($decgoogresp->success == true) {
      //Your success message or action here
      }
      else {
      //Your fail message or action here
      }

    • @wezhind1624
      @wezhind1624 6 лет назад

      +Alexandru Stefan It may be an idea to also include the USER-AGENT for completeness (being as some CORS issues can be remedied by its inclusion) - so, for instance, one would add the following to your code:
      curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0");

    • @julianm7999
      @julianm7999 6 лет назад

      I had the same problem. Thank you :)

    • @MrStepniewski
      @MrStepniewski 6 лет назад

      Hi, when I use your code, message about failing verification displays even BEFORE validation, what should I add to get message AFTER clicking on submit button? Thanks in advance man :)

  • @Appemans
    @Appemans 6 лет назад +1

    Very nice tutorials, I learned a lot from them.
    I just have one question. If I don't submit the 'I'm not a robot' button but save directly, the form will get a warning that I forgot to submit that I'm not a robot button. But my form now is also reset. All fields are empty again. If I make a long form and some one made a mistake, the whole form will be reset and have to be typed in again :(
    So how does it work that by mistake the form input will not be deleted?

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      Thank you!
      For your problem, you can use two different approaches:
      - use javascript and prevent form submitting before someone click on that button
      - directly from PHP output the data to input "value" attribute from $_POST
      Hope this helps. :)

  • @codingworld1075
    @codingworld1075 6 лет назад +1

    Nice and simple to understand, However, I wish to ask you if thesame procedure can be followed fof a live serve domain name or what do I need to change

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      Thank you. Yes, you can use the same procedure, and the only difference is that you instead of "localhost" need to put your domain name.

  • @cpccworkshop
    @cpccworkshop 4 года назад

    How do I get ReCaptcha to send the content of the form to my email? Please advise!

  • @francescomiraglia6319
    @francescomiraglia6319 3 года назад

    Thank you for this, very helpful. Now, in the case of successful verification, I need to pass the forms info to a page that stores those info in a database. What is the command to do that? Because before implementing captcha I was using the form action command but now I don't know how to do it ...

  • @gregory4431
    @gregory4431 3 года назад

    wow thanks!

  • @gr8zaheer
    @gr8zaheer 6 лет назад

    Easy method, easy way you make, love you 😍

  • @GracielaDiLelle
    @GracielaDiLelle 6 лет назад +1

    Great tutorial! Thanks!

  • @FerdinandAneke
    @FerdinandAneke 6 лет назад +1

    Thanks for this.

  • @sharongutierrez2803
    @sharongutierrez2803 7 лет назад +1

    Thank you! Nice and easy :)

    • @SenaidBacinovic
      @SenaidBacinovic  7 лет назад

      Sharon Gutierrez Thank you so much. Appreciate the support. :)

  • @habeasventuresinc.9858
    @habeasventuresinc.9858 5 лет назад +1

    Helped me alot ^^ thank you

  • @carlpabello1752
    @carlpabello1752 5 лет назад

    Thank you so much it really helps a lot sir! More tutorial to come :)

  • @BBLV
    @BBLV 4 года назад

    You have very good skills! Pleasure to watch

  • @fahadnoor2579
    @fahadnoor2579 6 лет назад +1

    Rock Star!

  • @ahmedatya6226
    @ahmedatya6226 4 года назад

    Excellent

  • @luxena3834
    @luxena3834 6 лет назад +1

    wonderful :-) thanks bro..very successfully

  • @shaikhsarfaraj5936
    @shaikhsarfaraj5936 5 лет назад +1

    Awesome , thanks sir

  • @oualidkhaldi4625
    @oualidkhaldi4625 7 лет назад +1

    thank you for this helpful tutorial

    • @SenaidBacinovic
      @SenaidBacinovic  7 лет назад +1

      OUALID KHALDI It is my pleasure! Thank you for support! :)

  • @ericktorres9853
    @ericktorres9853 4 года назад

    I am getting an error “missing-input-response” why is that?

  • @thtuskey
    @thtuskey 3 года назад

    How do you implement this to bring up the picture challenge? Isn't that v2?

    • @thtuskey
      @thtuskey 2 года назад

      (All figured out)

  • @Ruhgtfo
    @Ruhgtfo 4 года назад

    Sir, is there anyway to use CDN to cache message from php server so that client side won't have to frequently request the info within DB for saving the performance of server load~

  • @MrArya
    @MrArya 4 года назад

    life saver

  • @skivas4225
    @skivas4225 4 года назад

    Hey, how do you make the reCaptcha field a "required" field?

  • @donallong2369
    @donallong2369 5 лет назад

    Hey Senaid,
    How do I stop the form being submitted?
    The code that you showed in the video only echos out true or false after the form was submitted, so how can I stop the form from being submitted and saved if the user does not click the recaptcha???
    Thanks again,
    Donal

  • @MotorcyclesandZen
    @MotorcyclesandZen 4 года назад

    Good stuff. Thank you!

  • @tangitoaho4344
    @tangitoaho4344 7 лет назад +1

    great job.. thanks

  • @crazyproduction3473
    @crazyproduction3473 4 года назад

    You are the best :*

  • @devastator99
    @devastator99 3 года назад

    yes

  • @amazighi5948
    @amazighi5948 6 лет назад +1

    thank you bro

  • @kriswu0430
    @kriswu0430 4 года назад

    Make a video how to bypass recaptcha ♥

  • @tejasgokani
    @tejasgokani 7 лет назад +1

    Awesome. You are great !

    • @SenaidBacinovic
      @SenaidBacinovic  7 лет назад +1

      tejas gokani Thank you so much. Appreciate the support! :)

  • @harrisongreeves5697
    @harrisongreeves5697 5 лет назад

    Hmmm... Mine just echos "verification failed" regardless of what input I enter. Any suggestions?

    • @maryh971
      @maryh971 5 лет назад

      Mine just echos "verification failed" regardless as well. Did you get it figured out?

  • @TheMadHermit
    @TheMadHermit 6 лет назад +1

    Great tutorial. Liked and subscribed!

  • @user-wz7nu2ht3f
    @user-wz7nu2ht3f 5 лет назад +1

    thank you soo much :)

  • @JoseGonzalez-cd7pu
    @JoseGonzalez-cd7pu 6 лет назад +1

    great video...thanks a lot...

  • @kerolesmonsef4179
    @kerolesmonsef4179 5 лет назад +1

    Thanks

  • @valdezapg
    @valdezapg 6 лет назад +1

    Very good tutorial, thank you

  • @nepalcodetv6298
    @nepalcodetv6298 7 лет назад +1

    thank you great help

  • @alessandroederle9588
    @alessandroederle9588 7 лет назад +1

    Yes!

  • @developeraccount438
    @developeraccount438 6 лет назад

    Please create logout when user click wimdow back btn or click window refresh. For security..

  • @alktab8993
    @alktab8993 5 лет назад +1

    Very good this lean thank and than my friend 🌹

  • @ericmarrero1334
    @ericmarrero1334 5 лет назад

    Very good tutorial. Any chance on doing a tutorial for Recaptcha v3?

  • @sheerasai5948
    @sheerasai5948 7 лет назад

    hey senoid everything works well but at the bottom of input it says localhost is not in the list of supported domains for this site key what does it mean?

    • @SenaidBacinovic
      @SenaidBacinovic  7 лет назад +1

      sheera sai on 2:56 in the video, in the domains section you should insert localhost, just like I did, and everything should work without any problem.

    • @sheerasai5948
      @sheerasai5948 7 лет назад +1

      Coding Passive Income thank you so much will try..

    • @SenaidBacinovic
      @SenaidBacinovic  7 лет назад

      sheera sai let me know if there is anything else that I can help you with :)

    • @sheerasai5948
      @sheerasai5948 7 лет назад +1

      Coding Passive Income sure you are very humble never seen a brilliant programmer like you

    • @SenaidBacinovic
      @SenaidBacinovic  7 лет назад +1

      sheera sai thank you so much for support and nice words!

  • @ptomassss
    @ptomassss 4 года назад

    Hvala!

  • @mahadevaswamysshetty3163
    @mahadevaswamysshetty3163 6 лет назад +1

    thank u

  • @siwakwifrancis8332
    @siwakwifrancis8332 7 лет назад +1

    hi mr first of all big up to you! can you teach us on to intergrate the web app with the google email varification

    • @SenaidBacinovic
      @SenaidBacinovic  7 лет назад

      Siwakwi Francis Do you mean on forcing visitors to verify their email before they can keep using some parts of your website?