1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

HTML Generator Site

Discussion in 'PHP' started by exaro, Jul 11, 2005.

  1. #1
    I just started a site at http://ezweb.exaro.org for newbie html addicts, that need a site real quick. I'm using a form to provide choices for text, alignment, and colors of a webpage, and it will spit out some html to paste into a document. Right now it's only in it's early stages (no colors, and one template)

    But what I really needed was to know if anyone knew how to prevent people putting html tags into the form. Something that limits them only to <a>, <b>, <i>, and <br>, and anything else, will just print as an html tag on their page.
     
    exaro, Jul 11, 2005 IP
  2. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #2
    my approach:

    - replace all <XXX> with &lt;XXX&gt; [str_replace or any regular expression]
    - replace back to things you want to supprt :
    ( &lt;BR&gt; ==> <br /> etc)

    quick and dirty - but doable in a few minutes :)
     
    frankm, Jul 11, 2005 IP
  3. exaro

    exaro Peon

    Messages:
    615
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I know what I need to do, I just don't have any ideas for the actual code for it.
     
    exaro, Jul 11, 2005 IP
  4. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #4
    see htmlspecialchars()
     
    exam, Jul 11, 2005 IP