复制代码 代码如下:
uid<int(10)> :用户id
session_id<varchar(40)> :用户登录后系统产生的session_id,PHP可是使用session_id()函数获取
login_time<int(10)> :登录时间
logout_time<int(10)> :登出时间
复制代码 代码如下:
$uid = $_SESSION[uid] = $info[id];
$session_id = $_SESSION[session_id] = session_id();
$login_time = time();
$logout_time = time() 600;
$sql = "INSERT INTO member_login (uid,session_id,login_time,logout_time) values($uid,$session_id,$login_time,$logout_time)";
mysql_query($sql);
复制代码 代码如下:
if($_SESSION[uid]){
$uid = $_SESSION[uid];
$session_id = $_SESSION[session_id];
$logout_time = time() 600;
$sql = "UPDATE member_login SET logout_time=$logout_time WHERE uid=$uid AND session_id=$session_id";
mysql_query($sql);
}
新闻热点
疑难解答