1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Minneapolis, MN
    Rep Power
    I'm in the process of setting up a classified Ad's page where the users can post their own Ad's. No one 'oversees' the posts. Once an post is submitted its put on the website. What I'm wondering about is how do i prevent users from adding in commands like: <H1> or <b> or other HTML tags that would mess up my display and my organization?

    Is it possible to set something in the submission page that it will not allow the characters < or >? I'm using PHP3 for the interface.

  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Caro, Michigan
    Rep Power
    use htmlentities() or htmlspecialchars(). it'll replace the tags with codes to show the symbol.

    < becomes ;lt
    > becomes ;gt

    or something like that. basically, whatever they enter is what they get, it won't be a link.

    i think there is a function that strips all of the tags too, so they are just gone. i'm not sure what it's called though.

    ---John Holmes...

Similar Threads

  1. exit tag preventing html from precessing completely
    By jshain in forum PHP Development
    Replies: 1
    Last Post: January 27th, 2004, 10:13 AM
  2. How to get client email??Help plz
    By Gecko22 in forum ASP Programming
    Replies: 12
    Last Post: January 22nd, 2004, 01:40 PM
  3. saving input from html
    By struwelmann in forum Perl Programming
    Replies: 3
    Last Post: December 28th, 2003, 11:04 PM
  4. HTML pages truncated whenever SSI tag references PHP script
    By jwatson in forum Apache Development
    Replies: 1
    Last Post: August 13th, 2003, 11:42 PM
  5. how is Cpanel custom tag in html page
    By fenil in forum Perl Programming
    Replies: 2
    Last Post: August 11th, 2003, 09:31 AM

IMN logo majestic logo threadwatch logo seochat tools logo