0

post 変数をフィルタリングするには、インクルード ファイルで次の関数を使用します

function filter($post) {
    $post = trim(htmlentities(strip_tags($post)));

    if (get_magic_quotes_gpc())
        $post = stripslashes($post);

    $post = mysql_real_escape_string($post);

    return $post;
}

次のコードを使用してメイン ファイルの投稿配列をフィルタリングすると、

foreach($_POST as $key => $value) {
    $post[$key] = filter($value); 
}

私は受け取ります

Fatal error: Call to undefined function filter()

何か案が?

4

3 に答える 3