strange problem with stripslashes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lawrence

    strange problem with stripslashes

    Over on www.monkeyclaus.org I'm getting back slashes showing up on my
    web pages, where this function outputs. This despite the explicit use
    of stripslashes(). Does anyone know why this might be?









    function printRecentWebl ogEntries($numb erToGet=5, $htmlSeparator= "") {

    global $sql, $config;

    extract($config );



    $recentEntries = getRecentWeblog Entries($number ToGet);

    if ($recentEntries ) $recentEntries = processArray($r ecentEntries,
    "stripslashes") ;

    echo "\n\n\n<div class=\"recentW eblogEntries\"> ";

    echo "These are the most recent weblog entries on this website:";

    if ($htmlSeparator == "") echo "<table
    class=\"recentW eblogEntriesTab le\"><tr><td>" ;



    for ($i=0; $i < count($recentEn tries); $i++) {

    if ($i != 0 && $htmlSeparator == "") echo "</td><td>";
    if ($htmlSeparator != "") echo $htmlSeparator;

    $entry = $recentEntries[$i];

    extract($rwArra y=$sql->putEntryIntoNa medArray($entry ));

    $cbMainContent = stripslashes($c bMainContent);

    $cbHeadline = stripslashes($c bHeadline);

    $cbMainContent = strip_tags($cbM ainContent);

    $cbMainContent = substr($cbMainC ontent, 0, 120);



    echo "

    <a href=\"$self?pa geId=$cbId\">

    $cbHeadline - $cbMainContent <br> Posted by: $cbUserName

    </a>

    ";

    }





    if ($htmlSeparator == "")echo "</td></tr></table>";

    echo "</div>\n\n\n";



    }
  • Terence

    #2
    Re: strange problem with stripslashes

    Aha! GPC and magic quotes - boooooo!

    check out



    I do this for applications which may be deployed on web servers I have
    no control over...

    if(isset($_POST ) && get_magic_quote s_gpc()) {
    foreach($_POST AS $key=>$val) $_POST[$key] = stripslashes($v al);
    }


    I chould probably change $_POST to $_REQUEST...

    see http://au2.php.net/manual/en/languag...predefined.php for
    more info on these variables.

    Comment

    Working...