Notifications
Clear all

[Solved] reCatpcha Mod?

13 Posts
4 Users
3 Reactions
655 Views
(@parisian)
Posts: 14
Active Member
Topic starter
 

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 πŸ™‚


 
Posted : 01/01/2021 6:17 pm
Topic Tags
(@jimmi)
Posts: 95
Estimable 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

Β 


Never say that something is impossible because there will be always some dummy who will do it.
URL for efiction site: https://www.hpfanfiction.cz/
php: 8.1.33 MariaDB 10.5
efic version: 4.0.x
mods: storyimage, notifications, storyend

 
Posted : 02/01/2021 1:48 pm
(@psymommy)
Posts: 3
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


 
Posted : 02/01/2021 7:33 pm
(@parisian)
Posts: 14
Active Member
Topic starter
 
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.


 
Posted : 03/01/2021 7:04 am
(@parisian)
Posts: 14
Active Member
Topic starter
 
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 πŸ™


 
Posted : 03/01/2021 7:09 am
(@jimmi)
Posts: 95
Estimable 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.


Never say that something is impossible because there will be always some dummy who will do it.
URL for efiction site: https://www.hpfanfiction.cz/
php: 8.1.33 MariaDB 10.5
efic version: 4.0.x
mods: storyimage, notifications, storyend

 
Posted : 03/01/2021 8:36 am
(@parisian)
Posts: 14
Active Member
Topic starter
 
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


 
Posted : 03/01/2021 12:17 pm
(@parisian)
Posts: 14
Active Member
Topic starter
 

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


 
Posted : 03/01/2021 12:18 pm
(@parisian)
Posts: 14
Active Member
Topic starter
 

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>";

 
Posted : 04/01/2021 1:14 pm
Jimmi reacted
 kali
(@kali)
Posts: 307
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!

 
Posted : 04/01/2021 5:36 pm
Parisian reacted
(@parisian)
Posts: 14
Active Member
Topic starter
 
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 πŸ™‚


 
Posted : 04/01/2021 6:10 pm
 kali
(@kali)
Posts: 307
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!

 
Posted : 04/01/2021 6:21 pm
Parisian reacted
(@parisian)
Posts: 14
Active Member
Topic starter
 
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


 
Posted : 04/01/2021 6:27 pm
Share: