Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
Mod Name / Version: Enable 'Badwords' Filtering For Member Profiles & User List

Description: This will enable badwords filtering in
both a member's profile page & the user list in order to
help prevent spamming (used to increase search engine rankings).

After you find a user who is engaging in spamming, simply
add their spammed URL to your badwords filter list and all
profiles & the user list will automatically censor it.

** IMPORTANT: The badwords URL MUST be in the format: www.example.com
DO NOT ADD HTTP:// to it.

NOTE: This is specifically for v6.3, and I'm not entirely
sure if the changes will work correctly for newer versions,
although I think they should.

(the 'FIND THIS:' sections may be a li'l
different though, although that part will be easy to find
anyway).

Feel free to post any updates in this thread for v6.4 & v6.5, if necessary.

Working Under: UBB.Threads 6.3

Mod Status: Finished

Any pre-requisites:

Author(s): Twisty

Date: 07/30/04

Credits: AllenAyres & Joshpet for initiating the idea

Files Altered:

showprofile.php
showmembers.php

New Files:

Database Altered: no

Info/Instructions:

[STEP 1] In showprofile.php...

FIND THIS:

Code
// ---------------- <br />// Assign the stuff <br />   list ($CheckUser,$Fakeemail,$Name,$Totalposts,$Homepage,$Occupation,$Hobbies,$Location,$Bio,$ICQ,$Extra2,$Extra3,$Extra4,$Extra5,$Registered,$Picture,$Title,$Userstatus,$UNumber,$Rating,$Rates,$width,$height,$coppauser,) = $dbh -> fetch_array($sth); <br />   $dbh -> finish_sth($sth);


ADD AFTER IT, THIS:

Code
// --------------------------------------------------------------------- <br />// Substitute any filters/badwords with the $config[censored] variable <br />   $words[0] = ""; <br />   if ($config['censored']) { <br />      $badwords = @file("{$config['path']}/filters/badwords"); <br />      if (!is_array($badwords)) { <br />         $badwords = @file ("{$config['phpurl']}/filters/badwords"); <br />      } <br />      while (list($linenum,$line) = each($badwords) ) { <br />         $line = chop($line); <br />         if ( (preg_match("/^\r/",$line)) || (preg_match("/^\n/",$line)) ) { <br />            continue; <br />         } <br />         $islines = 1; <br />         $words[count($words)] = $line; <br />         // PHP4 ONLY <br />         // array_push ($words, $line); <br />      } <br />      if ($islines) { <br />         $badwords = join("|", $words); <br />         $badwords = preg_replace("/^\|/","",$badwords); <br /> <br />         $Homepage = preg_replace("/\b($badwords)\b/i",$config['censored'],$Homepage); <br />         $Fakeemail = preg_replace("/\b($badwords)\b/i",$config['censored'],$Fakeemail); <br />         $Name = preg_replace("/\b($badwords)\b/i",$config['censored'],$Name); <br />         $Occupation = preg_replace("/\b($badwords)\b/i",$config['censored'],$Occupation); <br />         $Hobbies = preg_replace("/\b($badwords)\b/i",$config['censored'],$Hobbies); <br />         $Location = preg_replace("/\b($badwords)\b/i",$config['censored'],$Location); <br />         $Bio = preg_replace("/\b($badwords)\b/i",$config['censored'],$Bio); <br />         $ICQ = preg_replace("/\b($badwords)\b/i",$config['censored'],$ICQ); <br />         $Extra2 = preg_replace("/\b($badwords)\b/i",$config['censored'],$Extra2); <br />         $Extra3 = preg_replace("/\b($badwords)\b/i",$config['censored'],$Extra3); <br />         $Extra4 = preg_replace("/\b($badwords)\b/i",$config['censored'],$Extra4); <br />         $Extra5 = preg_replace("/\b($badwords)\b/i",$config['censored'],$Extra5); <br />         $Title = preg_replace("/\b($badwords)\b/i",$config['censored'],$Title); <br />      } <br />   }



[STEP 2] In showmembers.php...

FIND THIS:

Code
// ---------------------------------------------------------------- <br />// Cycle through the users <br />   for($i=0;$i<$total;$i++){ <br /> <br />      list ($Username,$Reged,$ICQ,$Home,$Posts,$Status,$Uid) = $dbh -> fetch_array($sth);


ADD AFTER IT, THIS:

Code
// --------------------------------------------------------------------- <br />// Substitute any filters/badwords with the $config[censored] variable <br />   $words[0] = ""; <br />   if ($config['censored']) { <br />      $badwords = @file("{$config['path']}/filters/badwords"); <br />      if (!is_array($badwords)) { <br />         $badwords = @file ("{$config['phpurl']}/filters/badwords"); <br />      } <br />      while (list($linenum,$line) = each($badwords) ) { <br />         $line = chop($line); <br />         if ( (preg_match("/^\r/",$line)) || (preg_match("/^\n/",$line)) ) { <br />            continue; <br />         } <br />         $islines = 1; <br />         $words[count($words)] = $line; <br />         // PHP4 ONLY <br />         // array_push ($words, $line); <br />      } <br />      if ($islines) { <br />         $badwords = join("|", $words); <br />         $badwords = preg_replace("/^\|/","",$badwords); <br /> <br />         $Home = preg_replace("/\b($badwords)\b/i",$config['censored'],$Home); <br />         $ICQ = preg_replace("/\b($badwords)\b/i",$config['censored'],$ICQ); <br />      } <br />   }



:-)

Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.

Sponsored Links
Entire Thread
Subject Posted By Posted
Finished-[6.3] Enable 'Badwords' Filtering For Member Profiles & User List Twisty 07/30/2004 3:22 PM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Shock Hosting
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
AllenAyres
AllenAyres
Texas
Posts: 21,080
Joined: March 2000
Forum Statistics
Forums63
Topics37,583
Posts293,955
Members13,824
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 701
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 13
Top Posters
AllenAyres 21,080
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2026 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260108)