Word Filter - RMB Scripting
You appear not have have an account with us, Click HERE to register an account...
RMB Scripting
Navigation
  Home
  Contact
  FAQ
  Forum
  Topsites
  Members
  Competitions
  Affiliates
Downloads
  Templates
  Scripts
  Fonts
  Image Sets
  Software
  Other
 
Tutorials
  .htaccess
  Photoshop
  C/C++
  CSS
  Macromedia Flash
  MySQL
  PHP
  PHP - User System
  HTML
  Javascript
  Macintosh
  Macromedia Fireworks
  Visual Basic
  Visual C#
  Windows
  Other
 
Latest Tutorials
Liveprinter For Mac
Scrollbar Coloring
Connect to a MySQL Server
Enabling Windows Dream...
Make Vista 60% faster,...
Latest Comments
User System (Part 1)
User System (Part 1)
User System (Part 1)
Limit username restric...
Whos Online
Stats
Total Members: 468 [153]
Total Tutorials: 241
Newsest User: Lauraa
Todays Unique Hits: 19
Users Online: 2
MOD-Shadow, setsukemizuhara
2 Guests
Poll
Do you like this poll?
Yes
Maybe
No
Main Content
Tutorial: Word Filter By DanielXP
OK lets start of with the SQL

Run this is phpMyAdmin
   
CODE:
CREATE TABLE `filter` (
`id` int(11) NOT NULL auto_increment,
`word` varchar(50) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM;


Im sure you can think of loads of words you can put in this.

Now lets do the filter
filter.php
   
PHP:
<?php
//include your database connection
include("DBConnect.php");
//sets a php functions
function filter($content){
//selects rows from your database
$filter mysql_query("SELECT * FROM `filter`");
//loops all the rows out
while($wfilt mysql_fetch_array($filter))
{
//finds the string and replaces it with the consored image
$content str_replace ("$wfilt[word]","<img border='0' src='images/censored.gif'>",$content);
}
//returns the string after being filtered
return $content;
}
?>


Now save this imgage as censored.gif (Right click ~ Save as)



Now to use this filter you must include the filter.php into your page by using this

   
PHP:
include("filter.php");


Then to filter the words use this
   
PHP:
$text = filter($text);


Change the varibles above to what you want to filter on your site.
Difficulty: Easy
Views: 783
Rating:
Comments
Posted on Thursday 21st June 2007 at 04:14 PM
new2old
So where do you add the words?
I am really confused
Posted on Thursday 21st June 2007 at 04:40 PM
DanielXP
In the database. You add the word in a new row.
Posted on Thursday 21st June 2007 at 08:17 PM
SkillMaster
ya and you would include config.php not DBconnect.php?
Notice:
Remember to post long codes on our pastbin! - (http://rmb.pastebin.com/)
Add Comment
You must be logged in to post a comment.
Good Morning Guest
Username: 
Password: 
Remember Username
Links
RMB Arcade
GangstaMania
Free Domains
Free Games
Alien Design Toplist
Affiliates