1<?php 2 3global $dwfck_sessions_ini; 4 5 6$dwfck_sessions_ini = false; 7function dwfck_open($save_path, $session_name) 8{ 9 global $dwfck_sessions_ini; 10 global $sess_save_path; 11 $dwfck_sessions_ini = true; 12 $sess_save_path = $save_path; 13 return(true); 14} 15 16function dwfck_close() 17{ 18 return(true); 19} 20 21function dwfck_read($id) 22{ 23 24 global $sess_save_path; 25 26 $sess_file = "$sess_save_path/sess_$id"; 27 file_put_contents('session_read.txt', $sess_file); 28 return (string) @file_get_contents($sess_file); 29} 30 31function dwfck_write($id, $sess_data) 32{ 33 34 global $sess_save_path; 35 36 $sess_file = "$sess_save_path/sess_$id"; 37 file_put_contents('session_write.txt', $sess_file); 38 if ($fp = @fopen($sess_file, "w")) { 39 $return = fwrite($fp, $sess_data); 40 fclose($fp); 41 return $return; 42 } else { 43 return(false); 44 } 45 46} 47 48function dwfck_destroy($id) 49{ 50 51 global $sess_save_path; 52 53 $sess_file = "$sess_save_path/sess_$id"; 54 return(@unlink($sess_file)); 55} 56 57function dwfck_gc($maxlifetime) 58{ 59 global $sess_save_path; 60 61 foreach (glob("$sess_save_path/sess_*") as $filename) { 62 if (filemtime($filename) + $maxlifetime < time()) { 63 @unlink($filename); 64 } 65 } 66 return true; 67} 68 69function dwfck_unserialize() { 70 71 list($dw,$str) = explode('|',$sstr,2); 72 $inf = unserialize($str); 73 $ar = print_r($inf, true); 74 file_put_contents('DW_session', "$ar $sstr"); 75} 76 77function dwfck_session_start() { 78 global $dwfck_sessions_ini; 79 if(isset($_REQUEST['FCK_NmSp_acl'])) { 80 if(!$dwfck_sessions_ini) { 81 session_set_save_handler("dwfck_open", "dwfck_close", "dwfck_read", "dwfck_write", "dwfck_destroy", "dwfck_gc"); 82 } 83 session_id($_REQUEST['FCK_NmSp_acl']); 84 } 85 session_start(); 86} 87?> 88 89