Forum

Notifications
Clear all

reCatpcha Mod?  

Parisian
(@parisian)
Active Member

Hey All,

 

This is Pari, been on this forum since the beginning but had to create a new account on this new forum.

 

Anyway, I was wondering if anyone has modded Google reCaptcha into eFicition yet? I would appreciate any help as I am finding the built-in captcha is not stopping spam. I have had to turn off registration and reviews because it has gotten so bad.

Thank you 🙂

Quote
Topic starter Posted : 01/01/2021 11:17 pm
Topic Tags
Jimmi
(@jimmi)
Active Member

I found that it is already existing. Maybe you could ask somebody from this thread:

https://efiction.org/community/version-3-x-general-support/recaptcha-in-registration-page-solved/#post-19407

Oh, and write your PHP version please, thanks

 

ReplyQuote
Posted : 02/01/2021 6:48 pm
psymommy
(@psymommy)
New Member

I am having this issue too, @Parisian. My host took my site down because someone was using our contact form to spam users, ad the only way they will put it back up is to add recaptcha to the contact form. I did not find the solution on the linked page above.

Thanks in advance to anyone who can help.

 

psymom

www.twilighted.net

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

I found that it is already existing. Maybe you could ask somebody from this thread:

https://efiction.org/community/version-3-x-general-support/recaptcha-in-registration-page-solved/#post-19407

Oh, and write your PHP version please, thanks

 

Thank you, and sorry I am running eFiction version 3.5.3.

ReplyQuote
Topic starter Posted : 03/01/2021 12:04 pm
Parisian
(@parisian)
Active Member
Posted by: @psymommy

I am having this issue too, @Parisian. My host took my site down because someone was using our contact form to spam users, ad the only way they will put it back up is to add recaptcha to the contact form. I did not find the solution on the linked page above.

Thanks in advance to anyone who can help.

 

psymom

www.twilighted.net

Oh wow, I am very sorry about that @psymommy 🙁 The captcha for eFiction seems so complicated when I looked through the files to see if I could integrate recaptcha in it somehow. But it has not stopped spam at all. The spammage has gotten out of hand for me 🙁

ReplyQuote
Topic starter Posted : 03/01/2021 12:09 pm
Jimmi
(@jimmi)
Active Member
Posted by: @parisian    Thank you, and sorry I am running eFiction version 3.5.3.

Don't be sorry...  please, I would like to help, but I need to know PHP version of your server (PHP 5.x or PHP 7.x). And any old recapcha mod would be great help, I can fix things but I am not sure about creating new ones. According that other topic, it should be some available.

ReplyQuote
Posted : 03/01/2021 1:36 pm
Parisian
(@parisian)
Active Member
Posted by: @jimmi
Posted by: @parisian    Thank you, and sorry I am running eFiction version 3.5.3.

Don't be sorry...  please, I would like to help, but I need to know PHP version of your server (PHP 5.x or PHP 7.x). And any old recapcha mod would be great help, I can fix things but I am not sure about creating new ones. According that other topic, it should be some available.

Php Version is php 7.x

ReplyQuote
Topic starter Posted : 03/01/2021 5:17 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 if it works for you or not.

Thanks

ReplyQuote
Topic starter Posted : 03/01/2021 5:18 pm
Parisian
(@parisian)
Active Member

Forgot to add that you need to add this to your header.php, will not work without it:

echo "<script src='https://www.google.com/recaptcha/api.js'></script>";
ReplyQuote
Topic starter Posted : 04/01/2021 6:14 pm
Jimmi liked
kali
 kali
(@kali)
Reputable Member

@parisian Bless You!
We just had a mass spam attack last night and I was frantically coming here to search up reCaptcha.

Skins made by Kali are no longer supported!

ReplyQuote
Posted : 04/01/2021 10:36 pm
Parisian liked
Parisian
(@parisian)
Active Member
Posted by: @kali

@parisian Bless You!
We just had a mass spam attack last night and I was frantically coming here to search up reCaptcha.

I'm sorry to hear you got Spammied, I know the feeling well 🙁 I hope the reCaptcha code works for you okay.

Forgot to add that you need to add this to your header.php, will not work without it:

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

I have been trying to figure out how to implement reCaptcha into the efiction script for literally a couple of years now, with no luck. And two days ago thanks to hours of Google searches and YouTube I finally found the help I needed. And of course it was so much easier than I was making it out to be 😀 

Let us know if it works for you. So, far I only have myself to validate it is working 🙂

ReplyQuote
Topic starter Posted : 04/01/2021 11:10 pm
kali
 kali
(@kali)
Reputable Member

@parisian
I purposely failed it a few times and then created a test account properly and it seems to be working.

Skins made by Kali are no longer supported!

ReplyQuote
Posted : 04/01/2021 11:21 pm
Parisian liked
Parisian
(@parisian)
Active Member
Posted by: @kali

@parisian
I purposely failed it a few times and then created a test account properly and it seems to be working.

Awesome! Glad it worked for you @kali

ReplyQuote
Topic starter Posted : 04/01/2021 11:27 pm
Share: