mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 19:51:42 +09:00
#472 세션을 파일기반이 아닌 DB기반으로 사용하도록 변경하고 접속자 출력 위젯 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4290 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
474ca4df06
commit
ea2fede30e
42 changed files with 702 additions and 111 deletions
65
modules/session/session.controller.php
Normal file
65
modules/session/session.controller.php
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/**
|
||||
* @class sessionController
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief session 모듈의 controller class
|
||||
**/
|
||||
|
||||
class sessionController extends session {
|
||||
|
||||
/**
|
||||
* @brief 초기화
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
function open() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function close() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function write($session_key, $val) {
|
||||
if(!$session_key || !$this->session_started) return;
|
||||
|
||||
$args->session_key = $session_key;
|
||||
$output = executeQuery('session.getSession', $args);
|
||||
$session_info = $output->data;
|
||||
if($session_info->session_key == $session_key && $session_info->ipaddress != $_SERVER['REMOTE_ADDR']) {
|
||||
executeQuery('session.deleteSession', $args);
|
||||
return true;
|
||||
}
|
||||
|
||||
$args->expired = date("YmdHis", time()+$this->lifetime);
|
||||
$args->val = $val;
|
||||
|
||||
if(Context::get('is_logged')) {
|
||||
$logged_info = Context::get('logged_info');
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
} else {
|
||||
$args->member_srl = 0;
|
||||
}
|
||||
|
||||
if($session_info->session_key) $output = executeQuery('session.updateSession', $args);
|
||||
else $output = executeQuery('session.insertSession', $args);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function destroy($session_key) {
|
||||
if(!$session_key || !$this->session_started) return;
|
||||
|
||||
$args->session_key = $session_key;
|
||||
executeQuery('session.deleteSession', $args);
|
||||
return true;
|
||||
}
|
||||
|
||||
function gc($maxlifetime) {
|
||||
if(!$this->session_started) return;
|
||||
executeQuery('session.gcSession');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue