My ite has a php function to update users online status in my mysql DB it works great xcept if a user goes into my flash chatroom, then after several minutes it will appear as they are offline in my site because they aren't actively browsing the site, is there a way to load like a hidden iframe every x amount of minutes so the site things these users are logged in still?
below is my online function
function update_online_status(){
$temp=$_SESSION['info'];
$LOCALIP=$_SERVER['REMOTE_ADDR'];
$lastactive = time();
// according to privacy setting
$online_hide1="3".",";
$online_hide2=","."3".",";
$online_hide3=","."3";
$online_hide4="3";
$privacy="select COUNT(*) as cnt from friend_acc_setting where user_id='$temp[auto_id]' AND (privacy like '$online_hide1%' or privacy like '%$online_hide2%' or privacy like '%$online_hide3' or privacy='$online_hide4')";
$result_privacy=executequery($privacy);
$row = mysql_fetch_array($result_privacy);
if($row['cnt'] == 0 ){
$sql_online="select * from friend_online where userid='$temp[auto_id]'";
$result_online=executeQuery($sql_online);
if($line_online=mysql_fetch_array($result_online)){
$sql_update_online="update friend_online set lastactive=NOW() where userid='$temp[auto_id]' and ipaddress='$LOCALIP'";
executeQuery($sql_update_online);
} else {
if($temp[auto_id]!=''){
$unid=uniqid(rand());
$sql_insert_online="insert into friend_online (userid,onlineid,ipaddress,lastactive) values ('$temp[auto_id]','$unid','$LOCALIP',NOW())";
executeQuery($sql_insert_online);
}
}
}
$temp='';
$sql_delete="DELETE FROM friend_online WHERE lastactive <= DATE_SUB(NOW(), INTERVAL 20 MINUTE)";
executeQuery($sql_delete);
}