SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot Tikila's Avatar
    Join Date
    Jun 2007
    Location
    Toronto
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    combining strip tags with Kayzio's function...

    Greetings everyone
    In May30,2007,there was a post about input sanitization and Kayzio came up with a good function that he called postclean.It nicely wraps up addslashes,stripslashes and nl2br together.
    I just want to combine that function with strip tags and want someone to tell me whether it's the good format.It goes like this:

    $message = PostClean($_POST['message'], 1);

    adding strip tags to it,would it be like:

    $message = strip tags(PostClean($_POST['message'], 1));
    or
    $message = strip tags(PostClean($_POST['message']), 1);

    Thank you for any help.

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Hi Tikila and welcome to the forums

    to use strip_tags with the function you would use:
    PHP Code:
    $message PostClean(strip_tags($_POST['message']), 1); 
    However it might be easier to add it into the function directly to save typing it each time. Post or link to the function so we know which one you mean
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Zealot Tikila's Avatar
    Join Date
    Jun 2007
    Location
    Toronto
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by spikeZ View Post
    Hi Tikila and welcome to the forums

    to use strip_tags with the function you would use:
    PHP Code:
    $message PostClean(strip_tags($_POST['message']), 1); 
    However it might be easier to add it into the function directly to save typing it each time. Post or link to the function so we know which one you mean
    Thank you SpikeZ for your kind reply.yeah,i agree add it to the function is the best way to go.
    So others might find it useful as well,here's Kazio's function(PostClean):

    function PostClean($String, $nlbr = false) {
    if (get_magic_quotes_gpc()) {
    $String = stripslashes($String);
    }
    if ($nlbr) {
    $String = nl2br($String);
    }
    return mysql_real_escape_string($String);
    }


Bookmarks

Posting Permissions

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