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.

Blog text area issue ...

Discussion in 'PHP' started by Kevin Design, Aug 29, 2008.

  1. #1
    Hi, i've recently started to creare my own blogging script for a new site i'm doing - one issue that i've come accross is i obviously want the script to be secure from sql injection attacks and hacks so i've been advised to use a number of php functions (stripslashes, htmlspecialchars etc ...).

    The problem ive got is im wanting to be able to include html code to insert links, and perhaps things like youtube videos etc... but at the minute all that happens is the code gets inserted as plain text.

    Any advise on this would be much appreciated.

    Regards :)
     
    Kevin Design, Aug 29, 2008 IP
  2. Supah Fly

    Supah Fly Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    strip_tags($stringyouwanttostriptags, '<p><a>');

    I am sure this will work. strip_tags strips all tags out of whatever you want to strip, then if you want to still have tags in it you can allow them.

    I only use this function for stripping the html tags off of things, but i use it on all of my scripts and it hasn't failed me.

    Also your best alternative is to code html into things is to use something like BBCODE! Gotta love the stuff.

    etc.
     
    Supah Fly, Aug 29, 2008 IP
  3. Kevin Design

    Kevin Design Guest

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3


    Your a star mate thanks, i'll look into it ;)
     
    Kevin Design, Aug 29, 2008 IP