2008-03-17から1日間の記事一覧

既存dbからmigrationファイルを作る

rake db_schema_dumpで、db/schema.rbができあがる。 参考 http://tam.qmix.org/wiki/Migration.html

PHPで簡単なCSRF対策

php

smarty拡張クラスを作る function smarty_function_csrf_token($params, &$o_smarty){ if(session_id() == ""){ session_start(); } $key = session_id(); return "<input type=\"hidden\" name=\"_csrf_token\" value=\"". $key ."\" />"; } で、テンプレートで {csrt_token}で呼ぶと

phpのサニタイズはmagic_quotes_gpcがonだと\\\\\\\\ってなる

php

magic_quotes_gpc = Offにするのが基本みたい。 参考 [PHP4]phpの文字化けとphp.iniの設定 | ごった煮 - tips about programming and building a server

ログみる

postgresql.confのlog_statement = 'none'をいじる #log_statement = 'none' # none, ddl, mod, all log_statement = 'all' # none, ddl, mod, allそしたら log_directory = 'pg_log' のとこにできる。要postgresql再起動 参考 http://katsubemakito.net/cgi…