Code to Stop iFrame breaking

Discussion in 'PHP' started by Wrongfully Convicted, Aug 29, 2009.

  1. #1
    I need code that will stop iframe breaking?
     
    Wrongfully Convicted, Aug 29, 2009 IP
  2. osmasters

    osmasters Well-Known Member

    Messages:
    453
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    100
    #2
    What do you mean by iframe breaking?
     
    osmasters, Aug 29, 2009 IP
  3. almondj

    almondj Peon

    Messages:
    768
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    0
    #3
    This code is one that works for me.

    // Prevent iframes
        $text = preg_replace("/<iframe[^>]*>.*<*iframe[^>]*>/i", "", $text);
        // Prevent iframe
        $text = preg_replace("/<iframe[^>]*>/i", "", $text);
    PHP:
    The latter seems to work the best. Use both for best results though.
     
    almondj, Aug 29, 2009 IP
  4. Wrongfully Convicted

    Wrongfully Convicted Peon

    Messages:
    436
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    thanks almondj, i will give it a whirl and see what happens
     
    Wrongfully Convicted, Aug 30, 2009 IP