Thu, 2 September 2010

Total Visits
12170023
Visitors today: 3574

Main Menu
Home
Free Scripts
Free Email
Newsserver
Forum
Guestbook
Web Links
Contact

Our Sponsors
Stromvergleich

Chi Kien Uong
Bebelstrasse 90
70193 Stuttgart
Tel: +49(711) 4596534
Fax: +49(711) 9976123
Deutschland / Germany
If you are not registered or logged in, you may still use these forums but with limited features. Show recent topics 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in
Adding a simple human verification test
Goto page 1, 2, 3 ... 19, 20, 21  Next  
Post new topic   Reply to topic    proxy2.de Forum Index -> Advanced Guestbook Forum Printable version
View previous topic :: View next topic  
Author Message
Carbonize



Joined: 12 Jun 2003
Posts: 3961
Location: Bristol, UK

PostPosted: Mon May 30, 2005 11:05 am    Post subject: Adding a simple human verification test Reply with quote

Ok after numerous requests I have decided to write this mod to let you add a test to make sure the poster is human. It's not infallible and will not stop human posters from spamming. If you don't fancy trying to edit the files yourself you can find them pre edited at http://carbonize.co.uk/AG/

For Advanced Guestbook 2.3.1 and 2.3.2 (instructions for 2.2 are after)
For 2.3.3 and 2.3.4 follow 2.3.2

Open templates/form.php

Find
Code:
if(document.book.gb_comment.value == "") {


replace that with
Code:
 if(document.book.bottest.value == "") {
   alert("$LANG[ErrorPost12]");
   document.book.bottest.focus();
   return false;
 }
 if(document.book.gb_comment.value == "") {


next find
Code:
  <tr bgcolor="$VARS[tb_color_1]">
    <td width="25%"><div align="left" class="font2">$HTML_CODE<br>$SMILE_CODE<br>$AG_CODE</div></td>
    <td>


Replace that with
Code:
  <tr bgcolor="$VARS[tb_color_1]">
    <td width="25%" class="font2"><img src="$GB_PG[base_url]/img/user.gif" width="16" height="15" alt=""> Human Verification:</td>
    <td class="font2">To prove you are not a bot please type the word ARMADILLO into the box below.<br>
    <input type="text" size="42" maxlength="30" name="bottest"></td>
  </tr>
  <tr bgcolor="$VARS[tb_color_1]">
    <td width="25%"><div align="left" class="font2">$HTML_CODE<br>$SMILE_CODE<br>$AG_CODE</div></td>
    <td>


Remember to change the question to make it unique to your site.

Save and close the file

Now open addentry.php UNLESS you are using the guestbook as a module in PHP Nuke in which case make these changes to index.php

For 2.3.1 find
Code:
$gb_post->name = (isset($HTTP_POST_VARS["gb_name"])) ? $HTTP_POST_VARS["gb_name"] : '';


replace with
Code:
$gb_post->bottest = (isset($HTTP_POST_VARS["bottest"])) ? $HTTP_POST_VARS["bottest"] : '';
$gb_post->name = (isset($HTTP_POST_VARS["gb_name"])) ? $HTTP_POST_VARS["gb_name"] : '';


For 2.3.2 find
Code:
$gb_post->name = (isset($_POST["gb_name"])) ? $_POST["gb_name"] : '';


replace with
Code:
$gb_post->bottest = (isset($_POST["bottest"])) ? $_POST["bottest"] : '';
$gb_post->name = (isset($_POST["gb_name"])) ? $_POST["gb_name"] : '';


Save and close the file.

Now open lib/add.class.php and find
Code:
var $name = '';


replace that with
Code:
var $name = '';
  var $bottest = '';
  var $bottestanswer = 'armadillo'; /* this is the answer to the question. It must contain no '  */


Next find
Code:
if ($this->name == "") {


and replace that with
Code:
    if (!get_magic_quotes_gpc())
    {
     $this->bottest = addslashes($this->bottest);
     $this->bottestanswer = addslashes($this->bottestanswer);
    }
if ($this->name == "") {


Now find
Code:
} else {
            $this->url = trim($this->url);


Replace with
Code:
        } elseif ($this->bottest == '') {
                return $this->db->gb_error($this->db->LANG["ErrorPost12"]);
            } elseif (strtolower($this->bottest) != strtolower($this->bottestanswer)) {
                return $this->db->gb_error($this->db->LANG["ErrorPost13"]);
        } else {
            $this->url = trim($this->url);


Next find
Code:
$HIDDEN .= "<input type=\"hidden\" name=\"gb_name\" value=\"".$this->name."\">\n";


and replace it with
Code:
$HIDDEN .= "<input type=\"hidden\" name=\"gb_name\" value=\"".$this->name."\">\n";
$HIDDEN .= "<input type=\"hidden\" name=\"bottest\" value=\"".$this->bottest."\">\n";


Save and close the file.

Finally open lang/english.php (If your guestbook is not in English open the appropriate language file and change the messages into your own language.

Find
Code:
$LANG["ErrorPost11"] = "You forgot to fill in the Comment field. Please correct it and re-submit.";


and replace it with
Code:
$LANG["ErrorPost11"] = "You forgot to fill in the Comment field. Please correct it and re-submit.";
$LANG["ErrorPost12"] = "You forgot to fill in the Human Verification field. Please correct it and re-submit.";
$LANG["ErrorPost13"] = "The Human verification answer you supplied is wrong. Please correct it and re-submit.";


Save and close the file and you are done.

INSTRUCTIONS FOR 2.2

Open templates/form.php

Find
Code:
if(document.book.comment.value == "") {


replace that with
Code:
 if(document.book.bottest.value == "") {
   alert("$LANG[ErrorPost12]");
   document.book.bottest.focus();
   return false;
 }
 if(document.book.comment.value == "") {


next find
Code:
  <tr bgcolor="$VARS[tb_color_1]">
    <td width="25%"><div align="left" class="font2">$HTML_CODE<br>$SMILE_CODE<br>$AG_CODE</div></td>
    <td>


Replace that with
Code:
  <tr bgcolor="$VARS[tb_color_1]">
    <td width="25%" class="font2"><img src="$GB_PG[base_url]/img/user.gif" width="16" height="15" alt=""> Human Verification:</td>
    <td class="font2">To prove you are not a bot please type the word ARMADILLO into the box below.<br>
    <input type="text" size="42" maxlength="30" name="bottest"></td>
  </tr>
  <tr bgcolor="$VARS[tb_color_1]">
    <td width="25%"><div align="left" class="font2">$HTML_CODE<br>$SMILE_CODE<br>$AG_CODE</div></td>
    <td>


Remember to change the question to make it unique to your site.

Save and close the file

Now open addentry.php

find
Code:
$gb_post->name = (isset($HTTP_POST_VARS["name"])) ? $HTTP_POST_VARS["name"] : '';


replace with
Code:
$gb_post->bottest = (isset($HTTP_POST_VARS["bottest"])) ? $HTTP_POST_VARS["bottest"] : '';
$gb_post->name = (isset($HTTP_POST_VARS["name"])) ? $HTTP_POST_VARS["name"] : '';


Save and close the file.

Now open lib/add.class.php and find
Code:
var $name = '';


replace that with
Code:
var $name = '';
  var $bottest = '';
  var $bottestanswer = 'armadillo'; /* this is the answer to the question. It must contain no '  */


Next find
Code:
if ($this->name == "") {


and replace that with
Code:
    if (!get_magic_quotes_gpc())
    {
     $this->bottest = addslashes($this->bottest);
     $this->bottestanswer = addslashes($this->bottestanswer);
    }
if ($this->name == "") {


Now find
Code:
} else {
            $this->url = trim($this->url);


Replace with
Code:
        } elseif ($this->bottest == '') {
                return $this->db->gb_error($this->db->LANG["ErrorPost12"]);
            } elseif (strtolower($this->bottest) != strtolower($this->bottestanswer)) {
                return $this->db->gb_error($this->db->LANG["ErrorPost13"]);
        } else {
            $this->url = trim($this->url);


Next find
Code:
$HIDDEN .= "<input type=\"hidden\" name=\"name\" value=\"".$this->name."\">\n";


and replace it with
Code:
$HIDDEN .= "<input type=\"hidden\" name=\"name\" value=\"".$this->name."\">\n";
$HIDDEN .= "<input type=\"hidden\" name=\"bottest\" value=\"".$this->bottest."\">\n";


Save and close the file.

Finally open lang/english.php (If your guestbook is not in English open the appropriate language file and change the messages into your own language.

Find
Code:
$LANG["ErrorPost11"] = "You forgot to fill in the Comment field. Please correct it and re-submit.";


and replace it with
Code:
$LANG["ErrorPost11"] = "You forgot to fill in the Comment field. Please correct it and re-submit.";
$LANG["ErrorPost12"] = "You forgot to fill in the Human Verification field. Please correct it and re-submit.";
$LANG["ErrorPost13"] = "The Human verification answer you supplied is wrong. Please correct it and re-submit.";


Save and close the file and you are done.
_________________
Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus


Last edited by Carbonize on Thu Dec 22, 2005 7:05 pm; edited 23 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Carbonize



Joined: 12 Jun 2003
Posts: 3961
Location: Bristol, UK

PostPosted: Sat Jun 04, 2005 5:26 am    Post subject: Reply with quote

there was a small cock up above. In add.class.php it should be
var $bottest = '';
and not
var bottest = '';
_________________
Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Jozilla



Joined: 04 Jun 2005
Posts: 1
Location: Belgium

PostPosted: Sat Jun 04, 2005 11:03 am    Post subject: Reply with quote

I integrated the mod in my guestbook this morning, and it works fine. Thanks! Let's hope that it stops the spam.
However, I had to correct a slight mistake in the last change in lib/add.class.php, otherwise the answer would always be empty:

In the following line, the '$' in front of bottestanswer is wrong.
Code:
elseif (strtolower($this->bottest) != strtolower($this->$bottestanswer))


Correct line:
Code:
elseif (strtolower($this->bottest) != strtolower($this->bottestanswer))
Back to top
View user's profile Send private message
Carbonize



Joined: 12 Jun 2003
Posts: 3961
Location: Bristol, UK

PostPosted: Sat Jun 04, 2005 12:03 pm    Post subject: Reply with quote

Two mistakes isn't bad for a mod I made up as I typed it in here lol. Thank you for pointing out my mistake.
_________________
Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
fng



Joined: 08 Jun 2005
Posts: 2

PostPosted: Wed Jun 08, 2005 8:58 pm    Post subject: Reply with quote

I have included the mod into one of my guestbooks, including the error fix but now i'm getting a
Guestbook - Error
You forgot to fill in the Name field. Please correct it and re-submit.

i''m running ad_guestbook 2.3.1 and double checked all the changes, of course i put in a name in the name field as well as the human verification check.

Any ideas?
Back to top
View user's profile Send private message
Carbonize



Joined: 12 Jun 2003
Posts: 3961
Location: Bristol, UK

PostPosted: Wed Jun 08, 2005 9:01 pm    Post subject: Reply with quote

You've either made an error in addentry.php or add.class.php. Email the two files to me at webmaster@carbonize.co.uk
_________________
Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Carbonize



Joined: 12 Jun 2003
Posts: 3961
Location: Bristol, UK

PostPosted: Wed Jun 08, 2005 10:16 pm    Post subject: Reply with quote

Whoops just fixed the error I had above. It should of been
Code:
$gb_post->name = (isset($_POST["gb_name"])) ? $_POST["gb_name"] : '';
in 2.3.x Embarassed
_________________
Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
fng



Joined: 08 Jun 2005
Posts: 2

PostPosted: Wed Jun 08, 2005 10:31 pm    Post subject: Reply with quote

Very Happy working really good now! thanks for the great mod and the fast fix.
Back to top
View user's profile Send private message
Lady Rando



Joined: 03 Mar 2005
Posts: 14

PostPosted: Wed Jun 08, 2005 11:46 pm    Post subject: Reply with quote

fng wrote:
I have included the mod into one of my guestbooks, including the error fix but now i'm getting a
Guestbook - Error
You forgot to fill in the Name field. Please correct it and re-submit.

i''m running ad_guestbook 2.3.1 and double checked all the changes, of course i put in a name in the name field as well as the human verification check.

Any ideas?


I'm getting this same error. Question
Back to top
View user's profile Send private message
Carbonize



Joined: 12 Jun 2003
Posts: 3961
Location: Bristol, UK

PostPosted: Wed Jun 08, 2005 11:49 pm    Post subject: Reply with quote

Check the updated version of the instructions at the top.
_________________
Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Lady Rando



Joined: 03 Mar 2005
Posts: 14

PostPosted: Wed Jun 08, 2005 11:55 pm    Post subject: Reply with quote

Carbonize, even though my guestbook says it's 2.3.1 the coding in addentry.php looks like this:
$gb_post->name = (isset($HTTP_POST_VARS["name"])) ? $HTTP_POST_VARS["name"] : '';

instead of this:
$gb_post->name = (isset($_POST["gb_name"])) ? $_POST["gb_name"] : '';
Back to top
View user's profile Send private message
Carbonize



Joined: 12 Jun 2003
Posts: 3961
Location: Bristol, UK

PostPosted: Thu Jun 09, 2005 12:12 am    Post subject: Reply with quote

Actually 2.3.1 should say
Code:
$gb_post->name = (isset($HTTP_POST_VARS["gb_name"])) ? $HTTP_POST_VARS["gb_name"] : '';


Looks like I will have to alter that bit so it has sections for 2.2, 2.3.1 and 2.3.2 Neutral
_________________
Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Lady Rando



Joined: 03 Mar 2005
Posts: 14

PostPosted: Thu Jun 09, 2005 12:15 am    Post subject: Reply with quote

Thanks, I'll go give that a try.
Back to top
View user's profile Send private message
Lady Rando



Joined: 03 Mar 2005
Posts: 14

PostPosted: Thu Jun 09, 2005 12:22 am    Post subject: Reply with quote

This is what I did and I'm still getting the error:

$gb_post->bottest = (isset($HTTP_POST_VARS["bottest"])) ? $HTTP_POST_VARS["bottest"] : '';
$gb_post->name = (isset($HTTP_POST_VARS["gb_name"])) ? $HTTP_POST_VARS["gb_name"] : '';
Back to top
View user's profile Send private message
Carbonize



Joined: 12 Jun 2003
Posts: 3961
Location: Bristol, UK

PostPosted: Thu Jun 09, 2005 12:45 am    Post subject: Reply with quote

got a link?
_________________
Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    proxy2.de Forum Index -> Advanced Guestbook Forum All times are GMT
Goto page 1, 2, 3 ... 19, 20, 21  Next
Page 1 of 21

 
Jump to:  
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 © phpBB Group
Processed in 0.074279 seconds : 11 queries executed