GuidePedia

0


         <?php
         if (isset($_POST['submit'])) {
          $username = $_POST['username'];

           //ReCapcha Area Code
           $secretKey = "Your Secret Key";
           $responseKey = $_POST['g-recaptcha-response'];
          $userIP = $_SERVER['REMOTE_ADDR'];
          $url = "https://www.google.com/recaptcha/api/siteverify?secret=$secretKey&response=$responseKey&remoteip=$userIP";
          $response = file_get_contents($url);
          $response = json_decode($response);
         //ReCapcha Area COde End

        
         if ($response->success)
             echo "Verification success. Your name is: $username";
         else
             echo "Please Select Captcha failed!";
           }
          ?>
       <html>
           <head>
                <title>PHP ReCAPTCHA Tutorial</title>
             </head>
        <body>
            <form action="index.php" method="post">
               <input type="text" name="username" placeholder="What is your name?">
               <input type="submit" name="submit" value="Save">
               <div class="g-recaptcha" data-sitekey="6LfGElAUAAAAALoCZy6f6P1ii8cgjvG2ei8scqHA"></div>
            </form>
           <script src='https://www.google.com/recaptcha/api.js'></script>
        </body>
     </html>







Next
This is the most recent post.
Previous
Older Post

Post a Comment

 
Top