ひょんなことでお話しさせていただいたyudouhuさんから「CodeIgniter いいですよ」と聞き、ひょ
んなタイミングで調べてみたら、存外よかった。
特徴的だと思ったのはセッションの管理機構 がデフォルトではCookieをそのまま使用するらしく、
暗号化 もできるということで、ちょっと調べてみたらsecure属性 はつけられないみたいだった。
ここ でもちょっと書いたけど、我が国ではCookieのsecure属性については敏感な部分 がある
ので、パッチにしてみた。
まるでたいした修正じゃないし、set_cookie というヘルパー関数 も初期インストール状態では
どこからも参照されていなかったので、そのままいじる。
$this->load->helper('cookie');
#で
set_cookie($name, $value, $expire, $domain, $path, $prefix, 1);
#もしくは
$cookie = array(
'name' => 'The Cookie Name',
'value' => 'The Value',
'expire' => '86500',
'domain' => '.some-domain.com',
'path' => '/',
'prefix' => 'myprefix_',
'secure' => '1'
);
set_cookie($cookie);
と書く。
以下、パッチ。
*** cookie_helper.php.orig Thu Nov 20 12:25:28 2008
--- cookie_helper.php Thu Nov 20 12:28:52 2008
***************
*** 40,54 ****
* @param string the cookie domain. Usually: .yourdomain.com
* @param string the cookie path
* @param string the cookie prefix
* @return void
*/
if ( ! function_exists('set_cookie'))
{
! function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '')
{
if (is_array($name))
{
! foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'name') as $item)
{
if (isset($name[$item]))
{
--- 40,55 ----
* @param string the cookie domain. Usually: .yourdomain.com
* @param string the cookie path
* @param string the cookie prefix
+ * @param bool the cookie secure flag
* @return void
*/
if ( ! function_exists('set_cookie'))
{
! function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = 0)
{
if (is_array($name))
{
! foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'name', 'secure') as $item)
{
if (isset($name[$item]))
{
***************
*** 89,95 ****
}
}
! setcookie($prefix.$name, $value, $expire, $path, $domain, 0);
}
}
--- 90,96 ----
}
}
! setcookie($prefix.$name, $value, $expire, $path, $domain, $secure);
}
}