下面为session类的代码
复制代码 代码如下:
<?php
class session
{
static function init()
{
session_set_save_handler(
array("session","open"),
array("session","close"),
array("session","read"),
array("session","write"),
array("session","destroy"),
array("session","gc")
);
}
static function open($save_path,$session_name)
{
echo "session opening!<br>";
/*global $db,$REMOTE_ADDR;
$rs = $db->Execute("select * from Sessions where SessionID='".session_id()."'");
$arry=$rs->FetchRow();
if( $rs && $arry)
{
$db->Execute("update Sessions set SessionLast=NOW() where SessionID='".session_id()."'");
}
else
{
$query = "insert into Sessions set SessionID='".session_id()."',SessionName='$REMOTE_ADDR',SessionLast='NOW()'";
//echo $query;
$db->Execute($query);
}*/
return true;
}
static function close()
{
return(true);
}
static function read($id)
{
echo "session reading now!<br>";
global $db;
return true;
$timenow = strftime("%Y-%m-%d %H:%M:%S", time());
$query = "select SessionData from Sessions where SessionID='$id' and SessionLast > '$timenow'";
$rs = $db->Execute($query);
if(list($SessionData) = $rs->FetchRow())
{
//echo $SessionData;
return $SessionData;
}
else
{
return false;
}
}
static function write($id,$sess_data)
{
echo "session writing now!<br>";
global $db;
$rs = $db->Execute("select SessionID from Sessions where SessionID='$id'");
$num = $rs->RecordCount();
$unix_time = time()+MY_SESS_TIME;
//echo MY_SESS_TIME;
$dateleft = strftime("%Y-%m-%d %H:%M:%S", $unix_time);
if($num <= 0)
{
$sql = "insert into Sessions set SessionData='$sess_data', SessionName='".$_SERVER["REMOTE_ADDR"]."', SessionLast='$dateleft', SessionID='".session_id()."'";
}
else
{
$sql = "update Sessions set SessionData='$sess_data', SessionName='".$_SERVER["REMOTE_ADDR"]."', SessionLast='$dateleft' where SessionID='$id'";
}
$db->Execute($sql);
}
static function destroy($id)
{
echo "session destroying now!<br>";
global $db;
$sql = "DELETE FROM Sessions WHERE `SessionID` = '$id'";
$rs = $db->Execute($sql);
return $rs;
// $sess_file = "$sess_save_path/sess_$id";
//return(@unlink($sess_file));
}
/*********************************************
* WARNING - You will need to implement some *
* sort of garbage collection routine here. *
*********************************************/
static function gc($maxlifetime)
{
echo "session maxlifetime now!<br>";
global $db;
$timenow = strftime("%Y-%m-%d %H:%M:%S", time());
$sql = "DELETE FROM `$table_sessions` WHERE `SessionLast` < '$timenow'";
return $sess_db->Execute($sql);
//echo "now gc!<br>";
return true;
}
// proceed to use sessions normally
}
使用方法
复制代码 代码如下:
include("session.class.php");
session::init();
session_start();
define("MY_SESS_TIME", 3600); //SESSION 生存时长
$_SESSION["test"] = "abcdef";
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
- 小虎队.1990-红蜻蜓【飞碟】【WAV+CUE】
- 雷婷《寂寞烟火HQⅡ》头版限量[低速原抓WAV+CUE][1G]
- 赵传1996《黑暗英雄》台湾首版[WAV+CUE][1G]
- 张敬轩2005《我的梦想我的路》几何娱乐[WAV+CUE][1G]
- 群星《人到四十男儿情(SRS+WIZOR)》[原抓WAV+CUE]
- 马久越《上善若水HQCDII》[低速原抓WAV+CUE]
- 龚玥《女儿情思》6N纯银SQCD【WAV+CUE】
- 张惠妹《你在看我吗》大碟15 金牌大风[WAV+CUE][1G]
- 群星《左耳·听见爱情》星文唱片[WAV+CUE][1G]
- 群星《抖音嗨疯-DISCO英文版》[WAV+CUE][1G]
- 群星.1990-情义无价(TP版)【中唱】【WAV+CUE】
- 马兆骏.1990-心情·七月【滚石】【WAV+CUE】
- 方伊琪.1979-沙鸥(LP版)【星岛全音】【WAV+CUE】
- 蔡琴《醇厚嗓音》6N纯银SQCD【WAV+CUE】
- 陈曦《遇见HQCD》[WAV+CUE]