<?php
// Subroutine: set_online.php
// Xinfeng Chen, 2002.11.20
// require: class CForumBase
// input: $uip, $timestamp, $sv_user, $bid, $tid

if($interval>0){
 require_once('core/class_activity.php');
 $oAct=new CActivity;

 #--- Clean outdated records ---
 $flag=$oAct->load();
 while($flag){
  if($sv_user==$oAct->user || $uip==$oAct->ip){
   $flag=$oAct->delete();
  }elseif(($timestamp - $oAct->timestamp)>$interval){
   $flag=$oAct->delete();
  }else{
   $flag=$oAct->moveNext();
  }
 }

 #--- Add current user ---
 $oAct->appendNew();

 $oAct->ip=$uip;
 $oAct->timestamp=$timestamp;
 $oAct->user=($sv_user) ? $sv_user : '[·ΓΏΝ]';
 $oAct->hide=0;
 $oAct->bid=($bid) ? $bid : 0;
 $oAct->tid=($tid) ? $tid : 0;

 $oAct->update();
 $oAct->store();
}

?>