If you are not registered or logged in, you may still use these forums but with limited features. Show recent topics
  [Search] Search   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [FAQ]  FAQ 
[Register] Register / 
[Login] Login 
Blocking Words Modification  XML
Forum Index » Advanced Guestbook Modifications
Author Message
db
Beginner

Joined: 13/04/2006 01:10:42
Messages: 7
Location: USA
Offline

Carbonize,

I think I remember reading either here or on the Lazarus GB that either newer versions of AVG and/or Lazarus have the ability to block certain words from being posted (not just censor but actually block the poster from posting). I wanted to try this as another method of blocking spam (I remember you said on your site that links could be blocked with this mod and I figured out that my normal spammers use certain words that I can block w/o hurting the entries from true guestbook signees).

If you remember me, I am the person that uses AVG with phpWebSite and currently cannot update from 2.3.1. I can however, modify some things with the version I have and I was wondering if the block mod can be applied to 2.3.1?

If you or anyone else could help me out, I would greatly appreciate it.
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

The mods for AG will be easy enough. I will toss something together tomorrow.

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
db
Beginner

Joined: 13/04/2006 01:10:42
Messages: 7
Location: USA
Offline

Carbonize wrote:The mods for AG will be easy enough. I will toss something together tomorrow.


Wow, thank you Carbonize! I may not be able to update my version for awhile, but I will have a well-modded version to suit my needs nonetheless. I really appreciate that.
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

THIS IS NOT TESTED

open lib/add.class.php and replace
  1. if ($this->db->VARS["censor"]==1) {  
  2.     $this->name = $this->db->CensorBadWords($this->name);  
  3.     $this->location = $this->db->CensorBadWords($this->location);  
  4.     $this->comment = $this->db->CensorBadWords($this->comment);  
  5. }  


With

  1. if ($this->db->VARS['censor'] == 1)  
  2. {  
  3.    if ($this->db->CensorBadWords($this->name) || $this->db->CensorBadWords($this->email) || $this->db->CensorBadWords($this->location) || $this->db->CensorBadWords($this->comment))  
  4.    {  
  5.       return $this->db->gb_error($this->db->LANG['ErrorPost10']);  
  6.    }       
  7. }  


Save and close the file

Open up vars.class.php and replace

  1. function CensorBadWords($strg) {  
  2.     $replace = "#@*%!";  
  3.     $this->query("select * from ".$this->table['words']);  
  4.     while ($row = $this->fetch_array($this->result)) {  
  5.         $row['word'] = preg_quote($row['word'], '/');  
  6. strg = preg_replace('/'.$row['word'].'/i', $replace, $strg);  
  7.     }  
  8.     return $strg;  
  9. }  


With

  1. function CensorBadWords($strg)  
  2. {  
  3.    $this->query("select * from ".$this->table['words']);  
  4.    while ($row = $this->fetch_array($this->result))  
  5.    {  
  6.       //if (eregi($row['word'], $strg))  
  7.       $row['word'] = preg_quote($row['word'], '/');  
  8.       if (preg_match('/'.$row['word'].'/i', $strg))  
  9.       {  
  10.          return true;  
  11.       }  
  12.    }  
  13.    return false;  
  14. }  


Save and close the file

Open up comment.class.php and replace

  1. if ($this->db->VARS["censor"]==1) {  
  2.     $this->user = $this->db->CensorBadWords($this->user);  
  3.     $this->comment = $this->db->CensorBadWords($this->comment);  
  4. }  


With

  1. if ($this->db->VARS['censor'] == 1)   
  2. {  
  3.    if ($this->db->CensorBadWords($this->user) || $this->db->CensorBadWords($this->comment))  
  4.    {  
  5.       return $this->db->gb_error($this->db->LANG['ErrorPost10']);  
  6.    }  
  7. }  

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
db
Beginner

Joined: 13/04/2006 01:10:42
Messages: 7
Location: USA
Offline

I made the modifications.

When I tried to sign the book with an entry using the censored words, I got the following message.

  1. Fatal error: Call to undefined function: query() in /class/vars.class.php on line 269  


Is this what I am supposed to get (including it showing the full path of my folder) or something else (I assume something else)?
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

Did you put $this->query and not just query ?

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
db
Beginner

Joined: 13/04/2006 01:10:42
Messages: 7
Location: USA
Offline

Carbonize wrote:Did you put $this->query and not just query ?


I didn't make any other changes other than the ones you told me to make. Should I make that change and then let you know what happens?

**edit**

$this->query was already included in the original changes you suggested.
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

Email me your vars.class.php file. webmaster @ carbonize . co . uk

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
db
Beginner

Joined: 13/04/2006 01:10:42
Messages: 7
Location: USA
Offline

Carbonize wrote:Email me your vars.class.php file. webmaster @ carbonize . co . uk


Sent.
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

OK my mod is fine it's just that you are using a modified version of Advanced Guestbook and so I have emailed you the required change.

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
db
Beginner

Joined: 13/04/2006 01:10:42
Messages: 7
Location: USA
Offline

Carbonize wrote:OK my mod is fine it's just that you are using a modified version of Advanced Guestbook and so I have emailed you the required change.


I'm still getting the same error.
db
Beginner

Joined: 13/04/2006 01:10:42
Messages: 7
Location: USA
Offline

Thank you Carbonize! The blocking word mod works. Please consider this problem resolved.
lance0
Newbie

Joined: 17/09/2006 21:00:41
Messages: 1
Offline

Thanks for posting this turn-around for the "Blocking Words Modification".

I am great fan and user of AGB and by reading through some of the major topics I have learnd a lot and solved many problems (without asking a single question my self).

I host a Guestbook for a Gospel Choir and due to your support we now have a clean Guestbook (hopefully)!

It's a far better way to prevent SPAM by blocking then rather by replacing bad words with symbols like "#@*%!".

MAY GOD BLESS YOU ALL

Rainer Burgener
GospelGruppeGossau
Switzerland

RayB
taudelt39
Beginner

Joined: 16/05/2006 01:12:03
Messages: 16
Location: Wayne, NJ
Offline

This worked out perfectly...thanks alot.
[WWW] [Yahoo!] aim icon [MSN]
ikki831
Newbie

Joined: 05/12/2007 02:48:11
Messages: 3
Offline

This worked perfect! Lovin it.

 
Forum Index » Advanced Guestbook Modifications
Go to:   
Based on the open source JForum