Thread: striping text

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

    Join Date
    Aug 2000
    Posts
    15
    Rep Power
    0
    i want to set up a forum type script and i want to be able to strips html tags that people may use. how do i do this in php?

    i'd also like to strip out profanity and replace it with a * or something like that. i assume this will be done the same way as above.

    thanks in advance!!!
  2. #2
  3. No Profile Picture
    RyanP
    Guest
    Devshed Newbie (0 - 499 posts)
    use htmlspecialchars() to make html input "safe"

    http://www.php.net/manual/function.htmlspecialchars.php


    i don't think that php has a built-in profanity stripping function, so i would suggest just using a regular expression or two to replace the words that you don't want to appear

    for example:
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>$variableName = preg_replace("/s(profanity1|profanity2|profanityX)s/i", "****", $variableName);[/code]

    [This message has been edited by RyanP (edited August 13, 2000).]
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    15
    Rep Power
    0
    fantastic, thanks ryanp!!!!

Similar Threads

  1. help with tables and wordwrapping
    By junkedBrian613 in forum PHP Development
    Replies: 2
    Last Post: February 15th, 2004, 05:42 PM
  2. how to keep table on top, not centered??
    By vinyl in forum HTML Programming
    Replies: 2
    Last Post: January 20th, 2004, 06:19 PM
  3. float question
    By yeah-yeah in forum HTML Programming
    Replies: 10
    Last Post: January 15th, 2004, 03:59 PM
  4. Javascript scrollbar - stuck on last bit
    By NayMyoSan in forum JavaScript Development
    Replies: 0
    Last Post: January 3rd, 2004, 12:05 PM
  5. Mouse over questions. n00b. :o
    By Not Tony Danza in forum HTML Programming
    Replies: 2
    Last Post: December 2nd, 2003, 06:28 AM

IMN logo majestic logo threadwatch logo seochat tools logo