KohanaのInputクラスを検証。
xss_cleanメソッドってscriptタグを丸々消し去るのね。
ちなみにxss_cleanメソッドはクロスサイトスクリプティング攻撃防止フィルタ。
■controller
function index()
{
$posts = $this->input->post();
print Kohana::debug($posts);
echo sprintf("<pre>%s</pre>\n", print_r($posts, true));
echo sprintf("<pre>%s</pre>\n", print_r($this->input->xss_clean($posts), true));
}
■結果(HTMLソース)
<pre>Array
(
[name] => <b>a</b>
[email] => <script>aler(2);</script>
[email_confirm] => c
)
</pre><pre>Array
(
[name] => <b>a</b>
[email] => <script>aler(2);</script>
[email_confirm] => c
)
</pre>
<pre>Array
(
[name] => <b>a</b>
[email] => aler(2);
[email_confirm] => c
)
</pre>
当面ブログ記事はKohanaとPHPTALの作業メモになりそう^^;
ソフトウェア開発、アジャイルなどについてSE兼PGが思った事を書いてます。たまにプログラムも