|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
sbalay Smarty Rookie
Joined: 30 Aug 2011 Posts: 5
|
Posted: Tue Sep 13, 2011 2:13 pm Post subject: Recaptcha with smarty |
|
|
Have anyone tried to integrate reCaptcha with smarty templates..
Any suggestions...
Thanks.!! |
|
Back to top |
|
androidworkz Smarty Rookie
Joined: 08 Aug 2011 Posts: 15
|
Posted: Tue Sep 13, 2011 7:39 pm Post subject: |
|
|
What would be so difficult about doing that?
register.php
Code: |
require_once('recaptchalib.php');
// Get a key from https://www.google.com/recaptcha/admin/create
$publickey = "<public_key>";
$privatekey = "<private_key>";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
echo "You got it!";
} else {
# set the error code so that we can display it
$error = $resp->error;
}
}
$smarty->assign("recaptcha", recaptcha_get_html($pub_key, $error));
|
register.tpl
Code: |
{nocache}
{$recaptcha}
{/nocache}
|
|
|
Back to top |
|
syslogic Smarty n00b
Joined: 06 Oct 2011 Posts: 2
|
Posted: Thu Oct 06, 2011 12:36 am Post subject: Example |
|
|
I've posted a commented example to my blog. |
|
Back to top |
|
atomant Smarty n00b
Joined: 15 Feb 2019 Posts: 2
|
Posted: Fri Feb 15, 2019 2:53 am Post subject: |
|
|
What about reCaptchav3?
I can't get it working.
Smarty have remove the usage of {php} tags now |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sat Feb 16, 2019 7:21 am Post subject: |
|
|
Eight years passed…
Please post your question in a separate thread, with your code displaying your attempts and an explanation of what doesn't work for you. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|