Changing the captcha
« on: February 13, 2013, 04:56:17 PM »
I am trying to change the captcha so that I can use the google captcha. How can I make it work so that when the submit button is pressed it only goes to the next stage once the google captcha is valid.

Right now OsDate used the #1 captcha but I want to use the #2 version.



Re: Changing the captcha
« Reply #1 on: February 13, 2013, 05:37:02 PM »
Also I can't figure out why it displays both captcha?!?!? The second one is not in the code...

And why it keep saying I got the wrong code entered even though it matches perfectly...

Re: Changing the captcha
« Reply #2 on: February 13, 2013, 06:36:32 PM »
Ok found out why the #2 captcha was showing up. I had this in the code:

Code: [Select]
{php} require_once('captcha/recaptchalib.php');
$publickey = "KEY"; // you got this from the signup page
echo recaptcha_get_html($publickey);
{/php}

But now I removed it and I still keep getting: The security code you entered does not match the image. Please try again.

Re: Changing the captcha
« Reply #3 on: February 14, 2013, 11:25:34 AM »
Hi,

You probably won't like this answer  :) because it will take some time to load the tufat forum if it works at all but there is an excelent post on how to change to a different captcha. Sorry don't know the exact link but if the page loads with the a seach on captcha you will find it.
Kind regards,

Jan Oppeneer
working on template for 2.6 and OsdatePDO

My sites under construction:

www.oudere-homo-mannen.com
www.homosenioren.com
www.hotdatingplanet.eu

Will be testing for Osdater.

Re: Changing the captcha
« Reply #4 on: February 14, 2013, 01:53:27 PM »
OK so I fixed the issue, but now where in the PHP will I find the edit check for the old captcha, I want to disable it from checking since I won't be using it? I am currently using the old captcha but wanted to play around with the google one and see if I can get it to work.

Tufat is super slow these days so hard to use it...
« Last Edit: February 14, 2013, 02:01:17 PM by T_Tronix »

Re: Changing the captcha
« Reply #5 on: February 14, 2013, 02:10:39 PM »
Hi,

Tell me about slowness in Tufat forum  :) it is to bad because it has some real good mod for your problem.

Don't know if you use an editor like Dreamweaver. If there is something I can't find I use the search all files in a folder option of the editor and search for one of  the variables that is used in the tpl files. Most of the times i find the correct file on the first go. The search is quite fast and it looks in all the code.
Kind regards,

Jan Oppeneer
working on template for 2.6 and OsdatePDO

My sites under construction:

www.oudere-homo-mannen.com
www.homosenioren.com
www.hotdatingplanet.eu

Will be testing for Osdater.

*

Vink

  • *****
  • 329
    • NedDate.nl
Re: Changing the captcha
« Reply #6 on: February 14, 2013, 02:14:44 PM »
Hi

Like Oppeneer says: on the tufat forum there are some post how to completely remove the php captcha code from all the involved files.
I did that and must say its a very timeconsuming work.
To keep it simple you can disable the default captcha in admin > Global site settings > Number of characters for spam control code = 0
Regards
Vink
osDate 2.19a | PHP 5.3.8 | MySQL  5.0.91

Re: Changing the captcha
« Reply #7 on: February 14, 2013, 03:39:42 PM »
Hi,

I am on tufat right now your in luck.

This is a answer from cbg from a post of mine
The question was:
How to disable security code in some areas??
Not exactly what you where looking for but maybe it helps.

Answer CBG:

Backup first
The code to remove for Feedback is:

Open: feedback.php
Find and remove: (line: 57-59)

Code: [Select]
if ( (strtolower($_SESSION['spam_code']) != strtolower($_POST['spam_code']) || !isset($_SESSION['spam_code']) ) && $config['spam_code_length'] > 0)  {
$t->assign('msg', get_lang('errormsgs','121') );
} else {

Find:

Code: [Select]
$t->assign( 'success', $success );
}

Change to:

Code: [Select]
$t->assign( 'success', $success );
Open: feedback.tpl
Find and remove (line: 13 - 15)

Code: [Select]
{if $config.spam_code_length > 0}
CheckFieldString("noblank",form.spam_code,"{lang mkey='errormsgs' skey='120'}");
{/if}

Find and remove: (line: 84 - 105)

Code: [Select]
{if $config.spam_code_length > 0}
<tr>
<td >
{lang mkey='enter_spamcode'}:&nbsp;
</td>
<td valign="middle" style="padding-left: 5px;" nowrap>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle">
<input type="text" class="textinput" name="spam_code" id="spam_code" value="" />&nbsp;
</td>
<td valign="middle" nowrap>
<img src="captcha/SecurityImage.php"  alt="Security Code" id="spam_code_img" name="spam_code_img" />
&nbsp;&nbsp;
<a href="javascript:reloadCaptcha();" ><img src="captcha/images/arrow_refresh.png" alt="Refresh Code" border="0" /></a>
</td>
</tr>
</table>
</td>
</tr>
<tr><td colspan="2" height="6"></td></tr>
{/if}

For all the spam code files see attached file (don't know if this is the correct file on tufat but the one on rapidshare isn't available.

Another helpfull message:

Hello,

This is s simple mode to a few files. Look in the folder captcha... in images is the background of the letters, change to WHATEVER you want. Remember that the code grabs any one ramdomly so change them all, and yes you need multiple background file even if they are the same.

next back up SecurityImage.php, then open and modify a few lines

to make it more simple for my users I use

$chars = array("A","B","C","D","E","F","G","H","J",
"K","L","M","N","P","R","S","T",
"W","X","Y","Z","2","3","4","5","6","7","9");

farther down

$this->fontsize = 20;
$this->num_dots = 50; // How much Noise to add.

farther down


$yvalue = 30 - mt_rand(0, 2); // Randomly adjust y position.
$angle = mt_rand(-1,1);// Give text a slight random angle.



Listed here is the values I use which is almost straight very little noise Capitals and Numbers NO 0 or O, 1 or I or other confussing charicters.

Last in Admin, Global settings, Site Information near the bottom, change the "Number of characters for spam control code" to however many chariters you want to use each time, I use 4.

for recaptcha I would like to refer to the post of Thedoctor. A very detailed post for replacing captcha in recaptcha. http://forum.tufat.com/showthread.php?t=61281&highlight=recaptcha It is way to much to post here.




« Last Edit: February 14, 2013, 03:51:49 PM by oppeneer »
Kind regards,

Jan Oppeneer
working on template for 2.6 and OsdatePDO

My sites under construction:

www.oudere-homo-mannen.com
www.homosenioren.com
www.hotdatingplanet.eu

Will be testing for Osdater.

Re: Changing the captcha
« Reply #8 on: February 14, 2013, 03:43:03 PM »
Nice thanks!

I did most of that, I find one thing irritating, I am hosting on godaddy and the changes i make on the tpl files don't show up instantly. Is there a way to refresh things in order to see the chages made right away?

Re: Changing the captcha
« Reply #9 on: February 14, 2013, 03:55:05 PM »
Hi,

If I want to be sure of a instant refresh I delete the cach files and template files in the temp folder. If that doesn't work try the clean cach/histroy  of your browser. One or both always works for me
Kind regards,

Jan Oppeneer
working on template for 2.6 and OsdatePDO

My sites under construction:

www.oudere-homo-mannen.com
www.homosenioren.com
www.hotdatingplanet.eu

Will be testing for Osdater.

Re: Changing the captcha
« Reply #10 on: February 14, 2013, 04:02:45 PM »
Cool thanks I'll do that!

Got the recaptcha to work using that link you provided, one thing I hate is when the recaptcha is incorrect it sends to a diff page rather then give the error on the same page like it does with the other fields in the signup page. Not sure if this can be resolved.

Re: Changing the captcha
« Reply #11 on: February 14, 2013, 05:11:32 PM »
I want it to stay on signup.php rather then go on captchaerror.php as the code states

Code: [Select]
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ('<META HTTP-EQUIV="Refresh" CONTENT="0;URL=captchaerror.php">' .
"(reCAPTCHA said: " . $resp->error . ")");
}

if I change URL=captchaerror.php to signup.php it does bring it back but it doesn't show the error. It also shows a blank page for a second which is not really clean in my opinion. It does the same thing with the original code. I think it displays reCAPTCHA said: " . $resp->error .  on that white page.
« Last Edit: February 14, 2013, 05:14:24 PM by T_Tronix »

Re: Changing the captcha
« Reply #12 on: February 14, 2013, 06:23:22 PM »
Ok got it to show up on the same page instead of going to captchaerror.php

Changes to make:

Go into savesignup.php

and remove:

Code: [Select]
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ('<META HTTP-EQUIV="Refresh" CONTENT="0;URL=captchaerror.php">' .
"(reCAPTCHA said: " . $resp->error . ")");
}

now add under:

Code: [Select]
if ($password != $password2 or substr_count($password,' ') > 0) {
$err = INVALID_PASSWORD;
}

Add the following code (basically modifying the original spamcode to this):

Code: [Select]
if (!$resp->is_valid)
{
$err = INVALID_SPAMCODE;
}

Done!

Now working on the feedback one...

Re: Changing the captcha
« Reply #13 on: February 14, 2013, 06:33:54 PM »
OK here is the same fix for feedback.php

Replace:

Code: [Select]
if(isset($_POST['cmd'])){
require_once('captcha/recaptchalib.php');
$privatekey = "PRIVATE KEY";
$resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);

if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ('<META HTTP-EQUIV="Refresh" CONTENT="0;URL=captchaerror.php">' .
"(reCAPTCHA said: " . $resp->error . ")");
}
}

With:

Code: [Select]
$captchaurl = "captchaerror.php" ;
require_once('captcha/recaptchalib.php');
$privatekey = "PRIVATE KEY";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);

Replace:

Code: [Select]
if ( (strtolower($_SESSION['spam_code']) != strtolower($_POST['spam_code']) || !isset($_SESSION['spam_code']) ) && $config['spam_code_length'] > 0)  {
$t->assign('msg', get_lang('errormsgs','121') );
}

With:

Code: [Select]
if (!$resp->is_valid)  {
$t->assign('msg', get_lang('errormsgs','121') );
}

Enjoy :)