Forum

Notifications
Clear all

ReCaptcha in registration page (SOLVED)  

SJP
 SJP
(@sjp)
Trusted Member

Due to host issues, the regular Captcha does not show up on my site. I have seen some efiction sites that use ReCaptcha (which does not require a GD library), and I would like to use it on my site. I was able to get the reCaptcha box on the registration page, but not in the right area. Has anyone loaded this successfully on their page? If so, could you please let me know how you were able to accomplish it? Thank you for any help you can provide.

Quote
Topic starter Posted : 05/02/2013 4:54 am
Lyndsie
(@lyndsie)
Member Moderator

Sorry,  haven't done it. I do know at least one person who has that is still semi-active here, though.

ReplyQuote
Posted : 07/02/2013 8:32 am
SJP
 SJP
(@sjp)
Trusted Member

Hi Lyndsie,

Thanks for the reply. I've seen ReCaptcha on 2 other efiction sites, so I know it's possible. I even emailed the mods of both sites to see if they would be willing to give me a starting point, but I never got a response. Since I know it's possible, I've been trying over and over again to get it to work properly, but no luck. Obviously, the best way to handle this is move to a host who is responsive and will activate the GD library so I can use the built in captcha that efiction has. However, until my contract is up, that's not really a possibility. Since you do know someone who has recaptcha set up, would you be willing to ask them if they would take pity on me and help me out.

Thank you again for all your help!

ReplyQuote
Topic starter Posted : 19/02/2013 8:28 pm
Lyndsie
(@lyndsie)
Member Moderator

Will try!

ReplyQuote
Posted : 27/02/2013 9:12 pm
SJP
 SJP
(@sjp)
Trusted Member

Thank you so much, Lyndsie! I got a response from elyaeru and my Recaptcha is now working. I'm very grateful to you both for all your help.

ReplyQuote
Topic starter Posted : 28/02/2013 11:55 pm
psymommy
(@psymommy)
New Member

Hello,

 

This is marked as SOLVED I don't see the solution here. Does anyone have any information on how to do this? Thank you!

Thank you!

psymom

www.twilighted.net

ReplyQuote
Posted : 03/01/2021 12:27 am
Parisian
(@parisian)
Active Member
Posted by: @psymommy

Hello,

 

This is marked as SOLVED I don't see the solution here. Does anyone have any information on how to do this? Thank you!

Thank you!

psymom

www.twilighted.net

Yes, I was just about to ask the same. If anyone has figured out a way to mod reCaptcha into eFiction would you mind sharing the how-to, please? Thank you.

ReplyQuote
Posted : 03/01/2021 12:11 pm
Parisian
(@parisian)
Active Member

I forgot to say, I am currently running eFiction version 3.5.3.

ReplyQuote
Posted : 03/01/2021 12:28 pm
Parisian
(@parisian)
Active Member

I think I have figured it out, at least it works for me 🙂

 

*BACKUP YOUR FILES. Download a copy of the 'editbio.php' page found in the 'User' folder first

This is assuming you've already gotten your reCaptcha site key and secret key. If not you have to do that first by going here and signing up:Google ReCaptcha

 

Now, go to the User folder and open 'editbio.php'

right under the top section with the info about efiction script, right beneath this // ----------------------------------------------------------------------

 

I put this code:

if(isset($_POST['g-recaptcha-response'])) {
   // RECAPTCHA SETTINGS
   $captcha = $_POST['g-recaptcha-response'];
   $ip = $_SERVER['REMOTE_ADDR'];
   $key = 'INSERT SECRET KEY HERE';
   $url = 'https://www.google.com/recaptcha/api/siteverify';

   // RECAPTCH RESPONSE
   $recaptcha_response = file_get_contents($url.'?secret='.$key.'&response='.$captcha.'&remoteip='.$ip);
   $data = json_decode($recaptcha_response);

   if(isset($data->success) &&  $data->success === true) {
   }
   else {
      die('Your account has been logged as a spammer, you cannot continue!');
   }
 }

 

Take note of the red text, literally insert the secret key Google ReCaptcha assigned to you

 

Now, in the same 'editbip.php' page find this area:

$output .= "<div style='text-align: center; margin: 1em;'><INPUT type=\"hidden\" name=\"uid\" value=\"".(isset($user) ? $user['uid'] : "")."\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\">";

Replace it with this:

$output .= "<div style='text-align: center; margin: 1em;'><INPUT type=\"hidden\" name=\"uid\" value=\"".(isset($user) ? $user['uid'] : "")."\"><div class=\"g-recaptcha\" data-sitekey=\"INSERT SITE KEY HERE\"></div><br/><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\">";

Again, take note of the red text, literally insert the site key Google ReCaptcha assigned to you

Save editbio.php and then test it out. Like I said this worked for me. When I fill out all the required fields in efiction but don't check the recaptcha it takes me to a page that says, "Your account has been logged as a spammer, you cannot continue!" When I have filled out all the required field in Efiction and check the reCaptcha account is created and I am redirected to log in page 

 

Share your feedback on this is it works for you or not.

Thanks

ReplyQuote
Posted : 03/01/2021 5:15 pm
psymommy
(@psymommy)
New Member

Thank you, Parisian. I tried it, and it did not crash the site like my previous attempts, but it did not work. My hosting company has agreed to try to add it for me and has restored the site for the time being. Thanks again for your assistance.

ReplyQuote
Posted : 04/01/2021 4:28 am
Jimmi
(@jimmi)
Active Member

I thought you wanted a normal module for this, not to change core code.

At that code above is missing at least, so it can't work correctly.

 https://www.google.com/recaptcha/api.j s" 
ReplyQuote
Posted : 04/01/2021 9:22 am
Parisian
(@parisian)
Active Member
Posted by: @parisian

I think I have figured it out, at least it works for me 🙂

 

*BACKUP YOUR FILES. Download a copy of the 'editbio.php' page found in the 'User' folder first

This is assuming you've already gotten your reCaptcha site key and secret key. If not you have to do that first by going here and signing up:Google ReCaptcha

 

Now, go to the User folder and open 'editbio.php'

right under the top section with the info about efiction script, right beneath this // ----------------------------------------------------------------------

 

I put this code:

if(isset($_POST['g-recaptcha-response'])) {
   // RECAPTCHA SETTINGS
   $captcha = $_POST['g-recaptcha-response'];
   $ip = $_SERVER['REMOTE_ADDR'];
   $key = 'INSERT SECRET KEY HERE';
   $url = 'https://www.google.com/recaptcha/api/siteverify';

   // RECAPTCH RESPONSE
   $recaptcha_response = file_get_contents($url.'?secret='.$key.'&response='.$captcha.'&remoteip='.$ip);
   $data = json_decode($recaptcha_response);

   if(isset($data->success) &&  $data->success === true) {
   }
   else {
      die('Your account has been logged as a spammer, you cannot continue!');
   }
 }

 

Take note of the red text, literally insert the secret key Google ReCaptcha assigned to you

 

Now, in the same 'editbip.php' page find this area:

$output .= "<div style='text-align: center; margin: 1em;'><INPUT type=\"hidden\" name=\"uid\" value=\"".(isset($user) ? $user['uid'] : "")."\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\">";

Replace it with this:

$output .= "<div style='text-align: center; margin: 1em;'><INPUT type=\"hidden\" name=\"uid\" value=\"".(isset($user) ? $user['uid'] : "")."\"><div class=\"g-recaptcha\" data-sitekey=\"INSERT SITE KEY HERE\"></div><br/><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\">";

Again, take note of the red text, literally insert the site key Google ReCaptcha assigned to you

Save editbio.php and then test it out. Like I said this worked for me. When I fill out all the required fields in efiction but don't check the recaptcha it takes me to a page that says, "Your account has been logged as a spammer, you cannot continue!" When I have filled out all the required field in Efiction and check the reCaptcha account is created and I am redirected to log in page 

 

Share your feedback on this is it works for you or not.

Thanks

I forgot to add that you need to put this is the header.php file:

echo "<script src='https://www.google.com/recaptcha/api.js'></script>";

ReplyQuote
Posted : 04/01/2021 5:55 pm
Parisian
(@parisian)
Active Member
Posted by: @psymommy

Thank you, Parisian. I tried it, and it did not crash the site like my previous attempts, but it did not work. My hosting company has agreed to try to add it for me and has restored the site for the time being. Thanks again for your assistance.

Sorry @psymommy @jimmi is correct,

I forgot to add that you need to put this is the header.php file:

echo "<script src='https://www.google.com/recaptcha/api.js'></script>";
ReplyQuote
Posted : 04/01/2021 5:57 pm
Parisian
(@parisian)
Active Member
Posted by: @jimmi

I thought you wanted a normal module for this, not to change core code.

At that code above is missing at least, so it can't work correctly.

 https://www.google.com/recaptcha/api.j s" 

Yep, I forgot to add that you need to put this is the header.php file:

echo "<script src='https://www.google.com/recaptcha/api.js'></script>";

If there is a eFiction mod that integrates it into the script already, please feel free to share. But this method works perfectly for me.
ReplyQuote
Posted : 04/01/2021 5:58 pm
Share: