Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Dec 2007
    Posts
    145
    Thanks
    5
    Thanked 5 Times in 5 Posts

    Block PHP using PHP?

    I have a form where users can test HTML.

    I wish them not to be able to insert Flash, PHP or any other harmful codes.

    Does anybody have the codes for this?

    The following doesn't seem to work for PHP.
    Code:
    if (eregi('<?', $text)) {die("Not HTML");
    }

  • #2
    eak
    eak is offline
    Regular Coder eak's Avatar
    Join Date
    Jun 2002
    Location
    Nashville, TN
    Posts
    354
    Thanks
    0
    Thanked 26 Times in 26 Posts
    A good place to start with sanitizing your inputs is strip tags.

    Also, I don't see why you would need to filter out PHP.
    It would not be executed unless you eval() your users code. It would just show up as plain text.
    eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •