*

Recent

Author Topic: User online indicator?  (Read 4407 times)

Sterling

  • Jr. Member
  • **
  • Posts: 81
  • Force: +1/-0
    • Hitchhike games
User online indicator?
« on: April 07, 2009, 01:18:08 AM »
It would be really cool to see which users are online at any given moment!!!

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: User online indicator?
« Reply #1 on: April 07, 2009, 03:08:15 PM »
This is something that has been thought of, but is not the highest priority right now. It might take a bit before this one is availible. It is something that is on the back of our mind though.

Danny

  • Newbie
  • *
  • Posts: 41
  • Force: +5/-0
Re: User online indicator?
« Reply #2 on: April 07, 2009, 06:01:55 PM »
Something like this.

Run the query:
Code: [Select]
ALTER TABLE `dd_users` ADD `last_on` INT NOT NULL AFTER `plays` ;
Open core.php - find:
Code: [Select]
$usrdata = $db->fetch_row($db->query(sprintf('SELECT * FROM dd_users WHERE userid=\'%u\'', $suserid)));
Add After:
Code: [Select]
$db->query("UPDATE dd_users SET last_on = unix_timestamp() WHERE userid = '$suserid'");
Replace memberslist.php with (or modify it):

Code: [Select]
<?php
$max 
'70';
$show clean($_GET['page']);
if(empty(
$show)){
$show 1;
}
$limits = ($show 1) * $max
$r $db->query(sprintf("SELECT * FROM dd_users ORDER BY userid DESC LIMIT $limits,$max"));
$totalres mysql_result($db->query('SELECT COUNT(userid) AS total FROM dd_users'),0); 
$totalpages ceil($totalres $max); 
echo 
'

<table width="89%" align="center">
<tr>
<td colspan=\'5\' class=\'header4\'>User List</td>
</tr>
<tr>
<Th>#</th>
<th class="header4">User Name</th>
<th class="header4">Play Count</th>
<th class="header4">Online</th>
<th class="header4">Profile</th>
<th></th>
</tr>'
;
while(
$ir $db->fetch_row($r)){
if(
$ir['last_on'] >= time()-15*60){ 
$online '<font color=green><b>Online</b></font>'
}else{ 
$online '<font color=red><b>Offline</b></font>'
}

echo 
' <tr>
<td class="content4">'
.$ir['userid'].'</td>
<td class="content4">'
.$ir['username'].'</td>
<td class="content4">'
.$ir['plays'].'</td>
<td class="content4">'
.$online.'</td>
<td class="content4"><a href="#">View Profile</a></td>
</tr>'
;
}

echo 
'</table>
<div align="center">Pages: '
;
for(
$i 1$i <= $totalpages$i++){ 
echo 
'<a href="#" class="pagenat">'.$i.'</a>&nbsp;</div. ';

}
echo 
'<p>';
$pgname 'Member list';




?>

there you go  :)

Sterling

  • Jr. Member
  • **
  • Posts: 81
  • Force: +1/-0
    • Hitchhike games
Re: User online indicator?
« Reply #3 on: April 07, 2009, 07:44:01 PM »
Works perfectly....I mean "PERFECT"!!!!! Its looks nice too!!!

I'll be working on a place on the home page to show who's "online"...And i'll be posting it here for people to use. Or someone could beat me to it!!!!


Thanks Again DANNY ;)