CakePHP情報のまとめ

サニタイズの方法


CakePHPにはサニタイズ用のライブラリが用意されている。
利用するにはControllerのアクション内で
function xxxAction(){
    App:import('Sanitize');
    $text1 = $this->params['post']['text1'];
    $this->set("text1", Sanitize::stripAll($text1));
}
として利用する。

App:import('Sanitize');
でライブラリを読み込み、
Sanitize::stripAll($text1)
で値をサニタイズしている。

メソッド一覧

clean( $data, $options = array ( ) )
escape( $string, $connection = 'default' )
formatColumns( $model )
html( $string, $remove = false )
paranoid( $string, $allowed = array ( ) )
stripAll( $str ) -- <script>, <style>, <img>タグ部分、空白文字(改行・タブなど)を除去
stripImages( $str ) -- <img>タグ部分を除去
stripScripts( $str ) -- <script>, <style>タグ部分を除去
stripTags( $str, $tag ) -- 第2引数で指定した名前のタグを除去
stripWhitespace( $str ) -- 空白文字(改行・タブなど)を除去

Manual

データのサニタイズ(Data Sanitization) :: CakePHPによる作業の定石 :: マニュアル :: 1.2 Collection :: The Cookbook
http://book.cakephp.org/ja/view/153/Data-Sanitizat...
CakePHP: the rapid development php framework: Api : Sanitize
http://api.cakephp.org/class/sanitize

このページへのコメント

yhUouZ I appreciate you sharing this blog. Awesome.

0
Posted by seo thing 2013年12月20日(金) 16:58:23 返信

d7E7N8 <a href="http://rnppgumuepwi.com/">rnppgumuepwi</a>, [url=http://ofcyouykrhab.com/]ofcyouykrhab[/url], [link=http://qcpfmrcjmafo.com/]qcpfmrcjmafo[/link], http://hxfpshkuamxx.com/

0
Posted by vrgjnztjmw 2013年11月15日(金) 07:28:40 返信

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

Wiki内検索

フリーエリア

編集にはIDが必要です