$db->query("delete from gb_temp where (temp4<$limit_time or temp2='$ip') and temp1='$id' and temp3='online'"); //删除离线$onlinetime分钟的用户 $db->query("insert into gb_temp (temp1,temp2,temp3,temp4) values ('$id','$ip','online','$online_time')"); $Onres= $db->query("select count(*) from gb_temp where temp1='$id' and temp3='online'"); $Onlineuser= $db->fetch_array($onres); $Onlineuser= $onlineuser[0];