$tstamp= doubleval(date("YmdHis"));
$tstamp-=520;
$q->query("delete from user where (pass is null or pass='') and last<".$tstamp);
$q->query("delete from message where time<".$tstamp);
$q->query("select uid,name,last from user where rid=".$rid." and last>=".$tstamp);
?>