-
AuthorPosts
-
jp Friend
jp
- Join date:
- April 2012
- Posts:
- 105
- Downloads:
- 14
- Uploads:
- 32
- Thanks:
- 32
- Thanked:
- 5 times in 2 posts
April 17, 2014 at 1:56 pm #196837alexsmirnov Friendalexsmirnov
- Join date:
- July 2012
- Posts:
- 786
- Downloads:
- 1
- Uploads:
- 226
- Thanks:
- 226
- Thanked:
- 163 times in 119 posts
April 17, 2014 at 4:26 pm #531288Hi there,
Did you register your site with Google Recaptcha services at http://www.google.com/recaptcha and configure your Joomla “Captcha – Recaptcha” plugin with your own Public and Private Keys received from them?
If you did, please create a full backup of your web-site and update from your current J! 3.1.5 to the latest at the time of this writing J! 3.2.3, as your current “Captcha – Recaptcha” most likely contains this Joomla bug.
Hope this helps,
Alex
jp Friendjp
- Join date:
- April 2012
- Posts:
- 105
- Downloads:
- 14
- Uploads:
- 32
- Thanks:
- 32
- Thanked:
- 5 times in 2 posts
April 17, 2014 at 6:45 pm #531312Hi Alex
Yes I did configure the Captcha plug in with private and public key.
And I believe I have the latest updatesalexsmirnov Friendalexsmirnov
- Join date:
- July 2012
- Posts:
- 786
- Downloads:
- 1
- Uploads:
- 226
- Thanks:
- 226
- Thanked:
- 163 times in 119 posts
April 17, 2014 at 8:10 pm #531317<em>@jptromp 422266 wrote:</em><blockquote>
And I believe I have the latest updates
</blockquote>
Nope, you don’t. At the time I am writing this, your system still runs on Joomla 3.1.5:
Please do update your Joomla to 3.2.3 and see if this does the trick.
Regards,
Alex
jp Friendjp
- Join date:
- April 2012
- Posts:
- 105
- Downloads:
- 14
- Uploads:
- 32
- Thanks:
- 32
- Thanked:
- 5 times in 2 posts
April 17, 2014 at 8:53 pm #531320OK its done. but the Captcha is still not working
Atleast my slideshow on the homepage is working again
Regards
jpalexsmirnov Friendalexsmirnov
- Join date:
- July 2012
- Posts:
- 786
- Downloads:
- 1
- Uploads:
- 226
- Thanks:
- 226
- Thanked:
- 163 times in 119 posts
April 17, 2014 at 9:17 pm #531323You may try to create new Public and Private keys and see if they make the difference.
If that doesn’t help, please create a test subfoder, let’s say /test1/ and transfer in it your current web-site (I recommend you use Akeeba Backup for this job) for us to continue looking at your ReCaptcha issue.
Hope this helps,
Regards,
Alex
alexsmirnov Friendalexsmirnov
- Join date:
- July 2012
- Posts:
- 786
- Downloads:
- 1
- Uploads:
- 226
- Thanks:
- 226
- Thanked:
- 163 times in 119 posts
April 17, 2014 at 9:22 pm #531324In the mean time, could you please attach for your /plugins/captcha/recaptcha/recaptcha.php file to have a look at?
Cheers,
Alex
jp Friendjp
- Join date:
- April 2012
- Posts:
- 105
- Downloads:
- 14
- Uploads:
- 32
- Thanks:
- 32
- Thanked:
- 5 times in 2 posts
April 17, 2014 at 9:34 pm #531325[PHP]
<?php
/**
* @package Joomla.Plugin
* @subpackage Captcha
*
* @copyright Copyright (C) 2005 – 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/defined(‘_JEXEC’) or die;
/**
* Recaptcha Plugin.
* Based on the official recaptcha library( https://developers.google.com/recaptcha/docs/php )
*
* @package Joomla.Plugin
* @subpackage Captcha
* @since 2.5
*/
class PlgCaptchaRecaptcha extends JPlugin
{
const RECAPTCHA_API_SERVER = “http://www.google.com/recaptcha/api”;
const RECAPTCHA_API_SECURE_SERVER = “https://www.google.com/recaptcha/api”;
const RECAPTCHA_VERIFY_SERVER = “www.google.com”;/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;/**
* Initialise the captcha
*
* @param string $id The id of the field.
*
* @return Boolean True on success, false otherwise
*
* @since 2.5
*/
public function onInit($id)
{
$document = JFactory::getDocument();
$app = JFactory::getApplication();$lang = $this->_getLanguage();
$pubkey = $this->params->get(‘public_key’, ”);
$theme = $this->params->get(‘theme’, ‘clean’);if ($pubkey == null || $pubkey == ”)
{
throw new Exception(JText::_(‘PLG_RECAPTCHA_ERROR_NO_PUBLIC_KEY’));
}$server = self::RECAPTCHA_API_SERVER;
if ($app->isSSLConnection())
{
$server = self::RECAPTCHA_API_SECURE_SERVER;
}JHtml::_(‘script’, $server . ‘/js/recaptcha_ajax.js’);
$document->addScriptDeclaration(‘window.addEvent(‘domready’, function()
{
Recaptcha.create(“‘ . $pubkey . ‘”, “dynamic_recaptcha_1”, {theme: “‘ . $theme . ‘”,’ . $lang . ‘tabindex: 0});});’
);return true;
}/**
* Gets the challenge HTML
*
* @param string $name The name of the field.
* @param string $id The id of the field.
* @param string $class The class of the field.
*
* @return string The HTML to be embedded in the form.
*
* @since 2.5
*/
public function onDisplay($name, $id, $class)
{
return ‘<div id=”dynamic_recaptcha_1″></div>’;
}/**
* Calls an HTTP POST function to verify if the user’s guess was correct
*
* @param string $code Answer provided by user.
*
* @return True if the answer is correct, false otherwise
*
* @since 2.5
*/
public function onCheckAnswer($code)
{
$input = JFactory::getApplication()->input;
$privatekey = $this->params->get(‘private_key’);
$remoteip = $input->server->get(‘REMOTE_ADDR’, ”, ‘string’);
$challenge = $input->get(‘recaptcha_challenge_field’, ”, ‘string’);
$response = $input->get(‘recaptcha_response_field’, ”, ‘string’);// Check for Private Key
if (empty($privatekey))
{
$this->_subject->setError(JText::_(‘PLG_RECAPTCHA_ERROR_NO_PRIVATE_KEY’));return false;
}// Check for IP
if (empty($remoteip))
{
$this->_subject->setError(JText::_(‘PLG_RECAPTCHA_ERROR_NO_IP’));return false;
}// Discard spam submissions
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0)
{
$this->_subject->setError(JText::_(‘PLG_RECAPTCHA_ERROR_EMPTY_SOLUTION’));return false;
}$response = $this->_recaptcha_http_post(
self::RECAPTCHA_VERIFY_SERVER, “/recaptcha/api/verify”,
array(
‘privatekey’ => $privatekey,
‘remoteip’ => $remoteip,
‘challenge’ => $challenge,
‘response’ => $response
)
);$answers = explode(“n”, $response[1]);
if (trim($answers[0]) == ‘true’)
{
return true;
}
else
{
// @todo use exceptions here
$this->_subject->setError(JText::_(‘PLG_RECAPTCHA_ERROR_’ . strtoupper(str_replace(‘-‘, ‘_’, $answers[1]))));return false;
}
}/**
* Encodes the given data into a query string format.
*
* @param array $data Array of string elements to be encoded
*
* @return string Encoded request
*
* @since 2.5
*/
private function _recaptcha_qsencode($data)
{
$req = “”;foreach ($data as $key => $value)
{
$req .= $key . ‘=’ . urlencode(stripslashes($value)) . ‘&’;
}// Cut the last ‘&’
$req = rtrim($req, ‘&’);return $req;
}/**
* Submits an HTTP POST to a reCAPTCHA server.
*
* @param string $host Host name to POST to.
* @param string $path Path on host to POST to.
* @param array $data Data to be POSTed.
* @param int $port Optional port number on host.
*
* @return array Response
*
* @since 2.5
*/
private function _recaptcha_http_post($host, $path, $data, $port = 80)
{
$req = $this->_recaptcha_qsencode($data);$http_request = “POST $path HTTP/1.0rn”;
$http_request .= “Host: $hostrn”;
$http_request .= “Content-Type: application/x-www-form-urlencoded;rn”;
$http_request .= “Content-Length: ” . strlen($req) . “rn”;
$http_request .= “User-Agent: reCAPTCHA/PHPrn”;
$http_request .= “rn”;
$http_request .= $req;$response = ”;
if (($fs = @fsockopen($host, $port, $errno, $errstr, 10)) == false )
{
die(‘Could not open socket’);
}fwrite($fs, $http_request);
while (!feof($fs))
{
// One TCP-IP packet
$response .= fgets($fs, 1160);
}fclose($fs);
$response = explode(“rnrn”, $response, 2);return $response;
}/**
* Get the language tag or a custom translation
*
* @return string
*
* @since 2.5
*/
private function _getLanguage()
{
$language = JFactory::getLanguage();$tag = explode(‘-‘, $language->getTag());
$tag = $tag[0];
$available = array(‘en’, ‘pt’, ‘fr’, ‘de’, ‘nl’, ‘ru’, ‘es’, ‘tr’);if (in_array($tag, $available))
{
return “lang : ‘” . $tag . “‘,”;
}// If the default language is not available, let’s search for a custom translation
if ($language->hasKey(‘PLG_RECAPTCHA_CUSTOM_LANG’))
{
$custom[] = ‘custom_translations : {‘;
$custom[] = “t” . ‘instructions_visual : “‘ . JText::_(‘PLG_RECAPTCHA_INSTRUCTIONS_VISUAL’) . ‘”,’;
$custom[] = “t” . ‘instructions_audio : “‘ . JText::_(‘PLG_RECAPTCHA_INSTRUCTIONS_AUDIO’) . ‘”,’;
$custom[] = “t” . ‘play_again : “‘ . JText::_(‘PLG_RECAPTCHA_PLAY_AGAIN’) . ‘”,’;
$custom[] = “t” . ‘cant_hear_this : “‘ . JText::_(‘PLG_RECAPTCHA_CANT_HEAR_THIS’) . ‘”,’;
$custom[] = “t” . ‘visual_challenge : “‘ . JText::_(‘PLG_RECAPTCHA_VISUAL_CHALLENGE’) . ‘”,’;
$custom[] = “t” . ‘audio_challenge : “‘ . JText::_(‘PLG_RECAPTCHA_AUDIO_CHALLENGE’) . ‘”,’;
$custom[] = “t” . ‘refresh_btn : “‘ . JText::_(‘PLG_RECAPTCHA_REFRESH_BTN’) . ‘”,’;
$custom[] = “t” . ‘help_btn : “‘ . JText::_(‘PLG_RECAPTCHA_HELP_BTN’) . ‘”,’;
$custom[] = “t” . ‘incorrect_try_again : “‘ . JText::_(‘PLG_RECAPTCHA_INCORRECT_TRY_AGAIN’) . ‘”,’;
$custom[] = ‘},’;
$custom[] = “lang : ‘” . $tag . “‘,”;return implode(“n”, $custom);
}// If nothing helps fall back to english
return ”;
}
}[/PHP]
alexsmirnov Friendalexsmirnov
- Join date:
- July 2012
- Posts:
- 786
- Downloads:
- 1
- Uploads:
- 226
- Thanks:
- 226
- Thanked:
- 163 times in 119 posts
jp Friendjp
- Join date:
- April 2012
- Posts:
- 105
- Downloads:
- 14
- Uploads:
- 32
- Thanks:
- 32
- Thanked:
- 5 times in 2 posts
April 17, 2014 at 11:19 pm #531335Thank you Alex
Its working now
Kind regards
alexsmirnov Friendalexsmirnov
- Join date:
- July 2012
- Posts:
- 786
- Downloads:
- 1
- Uploads:
- 226
- Thanks:
- 226
- Thanked:
- 163 times in 119 posts
April 17, 2014 at 11:23 pm #531336You are welcome, Magic, and happy joomlarting.
Regards,
Alex
AuthorPostsViewing 11 posts - 1 through 11 (of 11 total)This topic contains 11 replies, has 2 voices, and was last updated by alexsmirnov 10 years, 8 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum
Jump to forum