4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2018, 06:39:23 PM

Login with username, password and session length
Search:     Advanced search
You're looking for some 4images templates and styles? Then visit this thread to show websites with 4images templates to download.
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Modifications / Modifikationen
| |-+  Templates & Styles (Releases & Support) (Moderator: Rembrandt)
| | |-+  [MOD] reCAPTCHA
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3 » »» Print
This topic has not yet been rated!
Author Topic: [MOD] reCAPTCHA  (Read 50151 times)
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« on: October 03, 2008, 03:57:30 AM »

This mod will replace 4images default captcha graphic with more advanced reCAPTCHA

Step 1
Register at http://recaptcha.net
Once registered, go to "My account" -> "My sites" and add each domain where you want use reCAPTCHA.
Then go to "My account" -> "My sites" and click on each domain you've added, it will show you Public Key and Private Key, write them down, you'll need them in next step.

Download PHP plugin, extract it and upload recaptchalib.php into 4images includes/ folder




Step 2
Open global.php
Find:
1
$captcha_filter_bg           1;

Insert BELOW:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$captcha_recaptcha           1//0 = disable; 1 = enable with auto domain select; "yourdomain" = for one specific domain only, this domain must be specified in $recaptcha_domains below
//$captcha_recaptcha           = "yourdomain2"; //use only reCAPTCHA keys for yourdomain2

$recaptcha_domains['yourdomain1'] = array("public key for yourdomain1""private key for yourdomain1");
/*//to add more then one domain:
$recaptcha_domains['example.com']   = array("public key for example.com", "private key for example.com");
$recaptcha_domains['4homepages.de'] = array("asdfasdfasdf", "a98sd7as9df7as");
$recaptcha_domains['google.com']    = array("23kj423h42k", "8fas9d8a9sdf9a");
*/
if ($captcha_enable && $captcha_recaptcha
    
&& (isset($recaptcha_domains[$captcha_recaptcha])
          || isset(
$recaptcha_domains[strtolower($_SERVER["HTTP_HOST"])])))
{
  
$captcha_recaptcha = (isset($recaptcha_domains[$captcha_recaptcha]))
                          ? 
$recaptcha_domains[$captcha_recaptcha]
                          : 
$recaptcha_domains[strtolower($_SERVER["HTTP_HOST"])];
}
else
{
  
$captcha_recaptcha 0;
}

In the code you just inserted update
1
$recaptcha_domains['yourdomain1'] = array("public key for yourdomain1""private key for yourdomain1");
with the correct data, yourdomain1 replace with the domain name of your website.  public key for yourdomain1 and private key for yourdomain1 with the public and private keys from Step 1.
You can add as many domains as you wish.




Step 3
Open includes/captcha_utils.php
Find:
1
$captcha_enable $captcha_enable && function_exists("imagecreatetruecolor") && function_exists("imagecopyresampled");

Replace it with:
1
2
3
4
5
6
7
8
9
10
11
12
13
function recaptcha_image()
{
  global 
$captcha_recaptcha;
  if (
$captcha_recaptcha)
  {
    require_once(
ROOT_PATH 'includes/recaptchalib.php');
    return 
recaptcha_get_html($captcha_recaptcha[0]);
  }
}
if (!
$captcha_recaptcha)
{
  
$captcha_enable $captcha_enable && function_exists("imagecreatetruecolor") && function_exists("imagecopyresampled");
}



Step 3.1
Find:
1
  $sess_code trim($site_sess->get_session_var('captcha'));

Insert ABOVE:
1
2
3
4
5
6
7
8
9
10
11
12
  global $captcha_recaptcha$HTTP_POST_VARS;
  if (
$captcha_recaptcha)
  {
    require_once(
ROOT_PATH 'includes/recaptchalib.php');
    
$resp recaptcha_check_answer ($captcha_recaptcha[1],
                                    
$_SERVER["REMOTE_ADDR"],
                                    
$HTTP_POST_VARS["recaptcha_challenge_field"],
                                    
$HTTP_POST_VARS["recaptcha_response_field"]);
    
    if (
$resp->is_valid)
      return 
true;
  }




Step 4
Open includes/page_header.php
Find:
1
  "url_captcha_image" => $site_sess->url(ROOT_PATH."captcha.php"),

Insert BELOW::
1
2
3
  "recaptcha" => ($captcha_recaptcha) ? recaptcha_image() : "",
  
"recaptcha_public" => @$captcha_recaptcha[0],
  
"recaptcha_private" => @$captcha_recaptcha[1],




Step 5
In templates comment_form.html, member_uploadform.html, postcard_preview.html, register_form.html and in any others where you were using captcha, use this tag:
{recaptcha}
If you wish to customize reCAPTCHA view to match your site theme or whatever, you probably will need do it via javascript (don't ask me how, I don't know), in that case you might need public or private key, for that you can use these tags:
{recaptcha_public}
{recaptcha_private}


P.S.
You can use both 4images built-in captcha and reCAPTCHA at the same time if you wish.

Follow members gave a thank to your post:
Sumale.my, Ruhrpottjung,

For this post, 3 members gave a thank you!
« Last Edit: July 15, 2010, 01:31:51 AM by V@no » Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
AntiNSA2
Hero Member
*****
Offline Offline

Posts: 774

Thank You
-Given: 0
-Receive: 2

As long as I can finish my site before I die.


View Profile WWW
« Reply #1 on: March 12, 2009, 08:15:21 PM »

works cool! POwer to the books and the blind people! Cool audio captcha.. first I was thinking... what the? but very cool.. better than entering numbers like a machiene Smile
Logged

As long as I can finish my site before I die.
Anarchology
Jr. Member
**
Offline Offline

Posts: 60

Thank You
-Given: 0
-Receive: 0

I LULZ too much!


View Profile WWW
« Reply #2 on: April 22, 2009, 07:20:12 AM »

Hi,

I feel stupid for asking, but I can't figure out how to incorporate the {recaptcha} into the pages. I would like to completely replace the 4Images Captcha with the reCaptcha mod. Can someone help me properly on how to substitute. I thought I added the tag in correctly, but nothing is showing up...

Original register_form.html block of code...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
            <td class="row2"><b>{lang_password}</b></td>
            <td class="row2"><input type="password" name="user_password" size="30" class="input" /></td>
          </tr>
          <tr>
            <td class="row1"><b>{lang_email}</b></td>
            <td class="row1"><input type="text" name="user_email" size="30" class="input" value="{user_email}" /></td>
          </tr>
{if captcha_registration}
          <tr>
            <td class="row1" valign="top"><b>{lang_captcha}</b></td>
            <td class="row1">
              <a href="javascript:new_captcha_image();"><img src="{url_captcha_image}" border="0" id="captcha_image" /></a> <br />
              <input type="text" name="captcha" size="30" value="" class="commentinput" id="captcha_input" />
              <br />
              {lang_captcha_desc}
            </td>
          </tr>
          {endif captcha_registration}
        </table>
      </td>
    </tr>
Logged

A personal THANK YOU to all of the great programmers on this site for helping me get my site from something basic to what it is today!

My site: http://taintedpix.com
(warning: some adult content)
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« Reply #3 on: April 22, 2009, 09:09:25 AM »

Where is {recaptcha} tag?
And make sure you did steps 1 and 2 properly.
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
Anarchology
Jr. Member
**
Offline Offline

Posts: 60

Thank You
-Given: 0
-Receive: 0

I LULZ too much!


View Profile WWW
« Reply #4 on: April 22, 2009, 11:19:32 AM »

I forgot to implement the PHP Plugin from the first step. I redid the other steps, but feel like I'm improperly adding the {recaptcha} string to the files. I have been testing it on the register_form.html. Below is the full modified script from that file. As of right now, nothing is showing up.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{lang_register_msg}
<form method="POST" action="{url_register}">
  <table width="100%" border="0" cellspacing="0" cellpadding="1">
    <tr>
      <td valign="top" class="head1">
        <table width="100%" border="0" cellpadding="4" cellspacing="0">
          <tr>
            <td colspan="2" valign="top" class="head1">{lang_register}</td>
          </tr>
          <tr>
            <td class="row1"><b>{lang_user_name}</b></td>
            <td class="row1"><input type="text" name="user_name" size="30" value="{user_name}" class="input" /></td>
          </tr>
          <tr>
            <td class="row2"><b>{lang_password}</b></td>
            <td class="row2"><input type="password" name="user_password" size="30" class="input" /></td>
          </tr>
          <tr>
            <td class="row1"><b>{lang_email}</b></td>
            <td class="row1"><input type="text" name="user_email" size="30" class="input" value="{user_email}" /></td>
          </tr>
{if captcha_registration}
          <tr>
            <td class="row1" valign="top"><b>{lang_captcha}</b></td>
            <td class="row1">{recaptcha}
            </td>
          </tr>
          {endif captcha_registration}
        </table>
      </td>
    </tr>
  </table>
  <input type="hidden" name="action" value="register" />
  <p align="center">
    <input type="submit" value="{lang_submit}" class="button" />
    <input type="reset" value="{lang_reset}" class="button" />
  </p>
</form>

Here is the test page, since I am newly creating the complete script, I will then move it over to my site...
http://www.savegasforums.com/register.php

^^^ You can see the reCAPTCHA isn't showing up.

Thanks in advance!
Logged

A personal THANK YOU to all of the great programmers on this site for helping me get my site from something basic to what it is today!

My site: http://taintedpix.com
(warning: some adult content)
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« Reply #5 on: April 22, 2009, 03:06:28 PM »

make sure you've registered savegasforums.com at your recaptcha account (step 1) and in step 2 you added the correct public and private keys for the domain.
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
Anarchology
Jr. Member
**
Offline Offline

Posts: 60

Thank You
-Given: 0
-Receive: 0

I LULZ too much!


View Profile WWW
« Reply #6 on: April 23, 2009, 05:06:14 AM »

Man, is this odd! Apparently, it is something on the host server's side. If I type my site in like "http://mysite.com", the captcha shows up. BUT... if I type in my site like "http://www.mysite.com", it doesn't show. I've had this happen to me again, so I think I can fix this.
Logged

A personal THANK YOU to all of the great programmers on this site for helping me get my site from something basic to what it is today!

My site: http://taintedpix.com
(warning: some adult content)
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« Reply #7 on: April 23, 2009, 05:48:40 AM »

no, www.mysite.com and mysite.com are two different domains. they might point to the same server, but they are different.
add both domains in you recaptcha account.
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
Anarchology
Jr. Member
**
Offline Offline

Posts: 60

Thank You
-Given: 0
-Receive: 0

I LULZ too much!


View Profile WWW
« Reply #8 on: April 23, 2009, 07:17:42 AM »

no, www.mysite.com and mysite.com are two different domains. they might point to the same server, but they are different.
add both domains in you recaptcha account.

Ahhh, that I didn't consider. Thank you for the tip. I'll do that.
Logged

A personal THANK YOU to all of the great programmers on this site for helping me get my site from something basic to what it is today!

My site: http://taintedpix.com
(warning: some adult content)
Baz140
Pre-Newbie

Offline Offline

Posts: 6

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #9 on: June 16, 2009, 01:18:24 AM »

Have installed recaptcha because built in captcha showing red X server side unable to correct, recaptcha works fine
 BUT I have to leave captcha turned on otherwise recaptcha shows but is bypassed regardless of correct or not,
 How can I turn off captcha to remove red x but leave recaptcha working?
http://www.suffolkbandarchives.co.uk/4images/register.php
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« Reply #10 on: June 16, 2009, 02:33:14 AM »

You'll need remove it manually from comment_form.html and register_form.html templates.
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
Sebas Bonito
Sr. Member
****
Offline Offline

Posts: 271

Thank You
-Given: 4
-Receive: 1

Sebas Bonito


View Profile
« Reply #11 on: July 10, 2009, 01:07:10 AM »

Localisation (e.g. in german)

Just add the following part somewhere in the template (like register_form.html) above the {recaptcha}

1
2
3
4
5
<script>
var RecaptchaOptions = {
   lang : 'de'
};
</script>

de is (of course) the part for the localisation. So Spanish-Users should change this to es and french to fr.

Further informations here.



I've also made a tiny snippet to recaptcha an e-mail address
« Last Edit: July 10, 2009, 02:24:35 PM by Schnick und Schnack » Logged
bash-t
Newbie
*
Offline Offline

Posts: 20

Thank You
-Given: 0
-Receive: 7


View Profile
« Reply #12 on: August 20, 2009, 04:51:39 PM »

Hallo! Funktioniert der Mod noch mit der aktuellen 4images Version 1.7.7 und der Lib aus der recaptcha-php-1.10.zip?

Ich habe gestern das Mod versucht auf meiner privaten Gallery zu installieren. Zuvor hatte ich das Mod Ajax Comments / Comment Rating http://www.4homepages.de/forum/index.php?topic=23866.0 installiert.

Merkwürdigerweise wurde jeder Kommentar eingetragen, auch wenn ich im Recaptcha "Hützen Grützen" eingegeben habe (was selbstverständlich nicht abgefragt wurde) Wink

Daraufhin habe ich dieses Mod für sich auf meiner öffentlichen Testgallery http://www.pawlikonline.de/temp/4images/details.php?image_id=9 installiert, und komischerweise wird dort kein Kommentar akzeptiert (auch wenn ich das Captcha löse) Wink

Hat jemand einen Tipp für mich?

Anbei noch manuellen Änderungen in der global.php. Alles andere habe ich wie beschrieben installiert.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//$captcha_recaptcha           = 1; //0 = disable; 1 = enable with auto domain select; "yourdomain" = for one specific domain only, this domain must be specified in $recaptcha_domains below
$captcha_recaptcha           "pawlikonline.de"//use only reCAPTCHA keys for yourdomain2

$recaptcha_domains['pawlikonline.de'] = array("6Ldq6AcAAAAAA********************""6Ldq6AcAAAAAA********************");
/*//to add more then one domain:
$recaptcha_domains['example.com']   = array("public key for example.com", "private key for example.com");
$recaptcha_domains['4homepages.de'] = array("asdfasdfasdf", "a98sd7as9df7as");
$recaptcha_domains['google.com']    = array("23kj423h42k", "8fas9d8a9sdf9a");
*/
if ($captcha_enable && $captcha_recaptcha
    
&& (isset($recaptcha_domains[$captcha_recaptcha])
          || isset(
$recaptcha_domains[strtolower($_SERVER["HTTP_HOST"])])))
{
  
$captcha_recaptcha = (isset($recaptcha_domains[$captcha_recaptcha]))
                          ? 
$recaptcha_domains[$captcha_recaptcha]
                          : 
$recaptcha_domains[strtolower($_SERVER["HTTP_HOST"])];
}
else
{
  
$captcha_recaptcha 0;
}

Hint:Selbst wenn ich die Zeile
1
$captcha_recaptcha           = 1;
wieder einkommentiere sieht das Ergebnis gleich aus.

Viele Grüße,
Bash-T
Logged

4images Version: 1.7.7
Sebas Bonito
Sr. Member
****
Offline Offline

Posts: 271

Thank You
-Given: 4
-Receive: 1

Sebas Bonito


View Profile
« Reply #13 on: August 20, 2009, 04:57:00 PM »

Hast Du das auch mal als "Nicht-Admin" ausprobiert? Soweit ich das in Erinnerung habe, wird bei Admins die Captcha-Funktion nicht überprüft.
Logged
mawenzi
4images Moderator
4images Guru
*****
Offline Offline

Posts: 4500

Thank You
-Given: 36
-Receive: 121


View Profile
« Reply #14 on: August 20, 2009, 05:04:46 PM »

@Sebas Bonito
... richtig ... Wink

@bash-t
... willst du dir dieses gewaltige Captcha-Gerät tatsächlich in dein filigranes Template einpflanzen ...
... ich denke Captcha sollte nur eine Hilfe gegen Spam und so unscheinbar wie möglich auf der Seite sein ...
... selbst das Original 4images-Captcha ist mir zu gewaltig ... daher hier ... Wink
Logged

Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...
Pages: [1] 2 3 » »» Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.125 seconds with 22 queries.
Post your comments here