Jump to content

Search the Community

Showing results for tags 'recaptcha'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 6 results

  1. Hello I am receiving a huge amount of spam emails, now I am trying to implement Google Recaptcha V3 in my custom PHP From, I implemented all the steps for G-Recaptcha, but I receive error invalid-input-secret And I am sure that the secret code shout be copied right I added the below to the head tag <script src="https://www.google.com/recaptcha/api.js?render=6LfyPF0pAAAAAHLxp3315RTN7jrRvBe6kLdHGAiT"></script> <script> grecaptcha.ready(function() { grecaptcha.execute('6LfyPF0pAAAAAHLxp3315RTN7jrRvBe6kLdHGAiT', {action: 'submit'}).then(function(token) { let recaptchaResponse = document.getElementById("recaptchaResponse"); console.log(recaptchaResponse); recaptchaResponse.value = token; }); }); </script> Then added hidden input before the submit button in the Form <input type="hidden" name="recaptcha_response" id="recaptchaResponse"> <input class="contactInput no-border cursorPointer buttonStyle" name="submitContact" value="Submit" type="submit"> And finally, I implemented the PHP code if(isset($_POST['submitContact']) && $_SERVER['REQUEST_METHOD'] == 'POST'){ $recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify'; $recaptcha_secret = '6LfyPF0pAAAAAEsS5lfN_WL3wKHh1XfGo0oE_PYU'; $recaptcha_response = $_POST['recaptcha_response']; $recaptcha = file_get_contents($recaptcha_url."?secret=".$recaptcha_secret."?response=".$recaptcha_response); $recaptcha = json_decode($recaptcha); if($recaptcha->success ==true){ if($recaptcha->score >= 0.5){ echo "Recaptcha Success"; }else{ echo"<pre>"; print_r("Recaptcha Not Verified"); echo"</pre>"; } }else{ echo"<pre>"; print_r($recaptcha); echo"</pre>"; } } But receiving the below error stdClass Object ( [success] => [error-codes] => Array ( [0] => invalid-input-secret ) )
  2. Hi all, I am sorry if I am posting this in the wrong place. If so, kindly transfer it to the appropriate section. I was using code that used recaptcha and that worked perfectly well. Now it has stopped working. The recaptcha dialog box simply does not display. Does anyone have any clue what could be going on? Has someone else also faced this similar problem recently Thanks all.
  3. I implemented google's reCAPTCHA V2 on http:// on the remote apache shared server and it worked 100%. I then changed the protocol to my shared server SSL using the same PHP script as the non-SSL script. The older version of reCaptcha had an SSL 'false' to 'true' SSL parameter, whereas I can't find one for V2. I had to use htaccess to redirect the example.com to the shared SSL server https://serverid.net/example/ which works perfectly without recCAPTCHA. I incorporated reCAPTCHA V2 and the error message where the reCAPTCHA image should be shows "ERROR: Invalid domain for site key". Here's the htaccess: RewriteEngine On RewriteCond %{HTTP_HOST} ^(.*)example\.com [NC] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://servername.net/example/$1 [R,L] And the recaptchalib.php code in case that helps: https://github.com/google/ReCAPTCHA/blob/master/php/recaptchalib.php Anyone know how to make this work? (If this is not the right forum for this, please direct me to the appropriate one. Thx)
  4. Hi I have a form which collects information from a user, it also has an option to upload files. I placed a recaptcha control on the form to avoid bots. However the problem is i have many fields on the form which are lost if i give a wrong captcha. I'm using hidden fields to store input values, so if user enters wrong captcha i'm restoring field values from the hidden fields, however i don't know how this can be done if the input type is file. Is it possible to store file info in the hidden field too, is yes how? at the moment it is major problem if user enters wrong code after selecting some files. Thanks for any input.. yesvee
  5. Hi I'm new to php, i've been struggling for 2 days to write a simple code with recaptcha. My requirements is i have a registration form (reg.php) with 20 fields on it after all the required information is filled in the form data is submitted to Create Account page (CreateAccount.php). I placed a recaptcha control on the first page (reg.php) to secure the form from bots. I'm doing some javascript validation on the client side for required fields, and finally validating if correct recaptcha code is entered on the server side. That means the form is submitted to itself first for recaptcha validation, after the code is valid i want to resubmit the data to Account Creation page. i don't know how to do this. the CreateAccount.php has got a complex logic so i can not move it to the same reg.php page. i tried the following but with no luck... if ($_POST["recaptcha_response_field"]) { $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if ($resp->is_valid) { //redirect to AccountCreation.php header("Location: AccountCreation.php"); } else { $error = $resp->error; } } please help me how this is done is php. Is there any other way of doing it simply...
  6. Hey guys, i was trying to add google recaptcha to my login register system, for a spam defense and just to give it a more professional feel. i already have my own conditional in my own system to make sure an email is not already used or to make sure a password is a certain length, etc.... i now want to add the existing code from google and add an additional conditional to make it flow as one. my issue so i followed the directions from goodle developers and when implementing the code by itself on a test page, i encounter no problems. i get the proper pass and fail, depending on what security code is entered. when i move that same logic into my already created system i then get a consistent failure with no pass. i am utterly confused as to why this is happening, if you guys can give me any suggestions that would be great. my code TEST PAGE .. WORKS FINE <?php include('include/init.php'); include('include/header.php'); require_once 'recaptchalib.php'; $privatekey = "6Lf5AeASAAAAAO5DJ1GcIAiwd8kkNbVBgrDrandom"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { echo 'FAILURE'; } else { echo 'SUCCESS'; // Your code here to handle a successful verification } ?> <tr> <form method='post' action='test.php' id='test'> <td class="register_td_left2"><span class="">Security Code:</span></td> <td valign="middle" style="padding-left:2px"> <?php require_once 'recaptchalib.php'; $publickey = "6Lf5AeASAAAAAPue6LLdUDttmPDc-NbRHcnrandom"; // you got this from the signup page echo recaptcha_get_html($publickey); ?></td> <input type='submit' value='Submit'></input> </form> </tr> Register page i try to implement the same logic require_once 'recaptchalib.php'; $privatekey = "6Lf5AeASAAAAAO5DJ1GcIAiwd8kkNbVBgrandom"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (empty($_POST) === false) { $required_fields = array('register_email','register_username','password','confirm_pass','gender','month','date','year','country'); foreach($_POST as $key => $value){ if (empty($value) && in_array($key, $required_fields) === true) { $errors[] = '* All fields are required!'; break 1; } } if (empty($errors) === true) { if (user_exists($_POST['register_username']) === true) { $errors[] = 'Sorry, the username \'' . $_POST['register_username'] . '\' has already been taken. Please choose another username.'; } if (preg_match("/\\s/", $_POST['register_username']) == true) { $errors[] = 'Sorry your username must not contain any spaces!'; } if (strlen($_POST['password']) < 6 ){ $errors[] = 'Your Password must be a minimal 6 characters long'; } if ($_POST['password'] !== $_POST['confirm_pass']) { $errors[] = 'Your Passwords do not match, please make sure both passwords are the same!'; } if (filter_var($_POST['register_email'], FILTER_VALIDATE_EMAIL) === false) { $errors[] = 'A valid email adress is required'; } if(email_exists($_POST['register_email']) === true){ $errors[] = 'The email you provided is already in use. If you are having trouble remembering your user info click <a href="#">here</a>'; } if (!$resp->is_valid) { $errors[] = 'You need to enter a valid security code'; } } } <form name="register" action="register.php" method="post"> <tr> <td class="register_td_left2"><span class="">Security Code:</span></td> <td valign="middle" style="padding-left:2px"> <?php require_once 'recaptchalib.php'; $publickey = "6Lf5AeASAAAAAPue6LLdUDttmPDc-NbRandom"; // you got this from the signup page echo recaptcha_get_html($publickey); ?></td> </tr> </form> i left out most of the form , just to save some reading time for you guys. figure its of no importance. again i am puzzled as to why this doesnt work for me on this page, yet on the test page it works fine. please i have been stuck on this for far to long for such a simple thing. thanks.
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.