rray($value_query);
if (isset($value[''value''])) {
return $value[''value''];
}
return false;
}
function _sess_write($key, $val) {
global $SESS_LIFE;
$expiry = time() + $SESS_LIFE;
$value = $val;
$check_query = mysql_query("select count(*) as total from sessions where sesskey = ''" . addslashes($key) . "''");
$check = mysql_fetch_array($check_query);
if ($check[''total''] > 0) {
return mysql_query("update sessions set expiry = ''" . addslashes($expiry) . "'', value = ''" . addslashes($value) . "'' where sesskey = ''" . addslashes($key) . "''");
} else {
return mysql_query("insert into sessions values (''" . addslashes($key) . "'', ''" . addslashes($expiry) . "'', ''" . addslashes($value) . "'')");
}
}
function _sess_destroy($key) {
return mysql_query("delete from sessions where sesskey = ''" . addslashes($key) . "''");
}
function _sess_gc($maxlifetime) {
mysql_query("delete from sessions where expiry < ''" . time() . "''");
return true;
}
session_set_save_handler(''_sess_open'', ''_sess_close'', ''_sess_read'', ''_sess_write'', ''_sess_destroy'', ''_sess_gc'');
}
danoo_session_name( ''dtvSid'' );
danoo_session_save_path(SESSION_WRITE_DIRECTORY);
还是有点不明白,open,write那些参数哪里来的。
修改php.ini配置的两个常用函数:
get_cfg_var(''session.gc_maxlifetime'') : 取得session.gc_maxlifetime的值
ini_set(''session.cookie_lifetime'',''0'') : 设置session.cookie_lifetime的值为0。