時には、ユーザが入力フォームにデータをコピー&ペーストしたとき、我々は次のような文字を取得します:着信文字列からすべての迷惑メールを削除するためのルーチン?
は引用符を開始し、â終了引用符などのための€のための“、€の™tをdid notの縮約形...
function fnSanitizePost($data) //escapes,strips and trims all members of the post array { if(is_array($data)) { $areturn = array(); foreach($data as $skey=>$svalue) { $areturn[$skey] = fnSanitizePost($svalue); } return $areturn; } else { if(!is_numeric($data)) { //with magic quotes on, the input gets escaped twice, which means that we have to strip those slashes. leaving data in your database with slashes in them, is a bad idea if(get_magic_quotes_gpc()) //gets current configuration setting of magic quotes { $data = stripslahes($data); } $data = pg_escape_string($data); //escapes a string for insertion into the database $data = strip_tags($data); //strips HTML and PHP tags from a string } $data = trim($data); //trims whitespace from beginning and end of a string return $data; } }
私は本当に私がから上記の言及のように文字を避けたい:私は(私はしばらく前にそれを書いただけでなく、改善を探しています)は、Webフォーム上で最も入力をサニタイズするために、このルーチンを使用
これまでに得たgデータベースに格納されている場合、サニタイズルーチンに正規表現置換を追加する必要がありますか?
おかげで、
-
ニコラス
それはスマートな引用の問題であるが、明らかにこれはのみMS Wordのは、切断/貼り付けに関与しているときに表示ように見える問題です。私はデシベルに入る前に、これらを交換したい場合は 私は、文字やそのコードの配列を作成する必要がありますか? (â€のœまたはその数値?) –