#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Canada
    Posts
    3
    Rep Power
    0
    I'm a newbie to php, I want to filter out certain words from my database. I was wondering how I would do this, and is there a way to store the list in a seperate file. ie. php making a call to a text file, if so how would i accomplish this?
    thanks for the help,
    Dave
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <<
    I was wondering how I would do this, and is there a way to store the list in a seperate file. ie. php making a call to a text file, if so how would i accomplish this?
    >>


    Yea, definitly it can be done...

    Either you can save that words in a file or in an array.then match with the table contents(probably you can loop through the contens and match with that words).





    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Canada
    Posts
    3
    Rep Power
    0
    how would i do this though? I'm relatively new to this, i know howto submit things into the database, but i'm clueless when it comes to filtering it out. I tried regular expressions once with no sucess.
    Dave
  6. #4
  7. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    Hi DaV0, do you mean filter out swear words etc? - if so you could filter them before or after insertion with,
    str_replace("badword","*****",$string);

    as Shiju suggests you could do this in a loop, & if you had your 'bad' words in a seperate textfile- 1 per line...

    <? $baddies=file("badwords.txt");//$baddies is now an array of the lines in the textfile//
    for($x=0;$x<count($baddies);$x++){
    str_replace($baddies[$x],"*****",$string);
    }?>


    or something similar (I did not test that!)



    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Canada
    Posts
    3
    Rep Power
    0
    ah cool thanks, so now i just have to figure out regular expressions =)
    Dave

Similar Threads

  1. Filtering Bad Words -- It works not.
    By SammyK in forum PHP Development
    Replies: 16
    Last Post: March 14th, 2005, 11:39 AM
  2. Filtering:
    By jmichels in forum ASP Programming
    Replies: 2
    Last Post: December 18th, 2003, 01:51 PM
  3. bad password log entry
    By rizzo65 in forum Perl Programming
    Replies: 1
    Last Post: September 28th, 2003, 03:07 PM
  4. filtering bad words
    By daza1 in forum Perl Programming
    Replies: 3
    Last Post: April 9th, 2003, 08:54 AM
  5. Castro's Quickstart Guide: Not _ALL_ That bad.
    By ErikSean in forum Perl Programming
    Replies: 11
    Last Post: August 20th, 2002, 07:02 PM

IMN logo majestic logo threadwatch logo seochat tools logo