mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@906 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
f44ce411f2
commit
7b70b78379
6 changed files with 80 additions and 12 deletions
56
classes/session/SessionHandler.class.php
Normal file
56
classes/session/SessionHandler.class.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* @class SessionHandler
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief 세션 핸들링 클래스
|
||||
**/
|
||||
|
||||
class SessionHandler extends Handler {
|
||||
|
||||
var $lifetime = 3600;
|
||||
var $ipaddress = '';
|
||||
var $session_path = './files/session/';
|
||||
|
||||
function open($path, $session_name) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function close() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function getSessionFile($session_key) {
|
||||
$session_file = sprintf('%szbxe_session_%s.php', $this->session_path, $session_key);
|
||||
return $session_file;
|
||||
}
|
||||
|
||||
function read($session_key) {
|
||||
$filename = $this->getSessionFile($session_key);
|
||||
if(!file_exists($filename)) return '';
|
||||
$buff = FileHandler::readFile($filename);
|
||||
return substr($buff, strlen('<?php if(!__ZBXE__) exit(); ?>'));
|
||||
}
|
||||
|
||||
function write($session_key, $val) {
|
||||
if(!$val) return true;
|
||||
|
||||
$filename = $this->getSessionFile($session_key);
|
||||
|
||||
$buff = '<?php if(!__ZBXE__) exit(); ?>'.$val;
|
||||
return FileHandler::writeFile($filename, $buff);
|
||||
}
|
||||
|
||||
function destroy($session_key) {
|
||||
$filename = $this->getSessionFile($session_key);
|
||||
@unlink( $filename);
|
||||
return true;
|
||||
}
|
||||
|
||||
function gc($maxlifetime) {
|
||||
foreach (glob($this->session_path.'zbxe_session_*.php') as $filename) {
|
||||
if (filemtime($filename) + $this->lifetime < time()) @unlink($filename);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue