Location: PHPKode > projects > Open ShareLive > F3-OSL-pre_alpha-2005_05_30/onlineusers.php
<?php
/******************************************************************************
*
*    Open ShareLive (main site code)
*    Copyright (C) 2002-2005  ShareLive
*
*    This program is free software; you can redistribute it and/or
*    modify it under the terms of the GNU General Public License
*    as published by the Free Software Foundation; either version 2
*    of the License, or (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with this program; if not, write to the Free Software
*    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*
******************************************************************************/

	require("tmpl_top.php");
?>
<?php
	if (!QuickCheck() || !$is_admin) {
		echo "no permission";
		include('tmpl_foot.php');
		exit;
	}
	$q = mysql_query("SELECT COUNT(*) FROM ".$dbprefix."users WHERE lastlogin > " . (time() - 86400) . " ORDER BY lastlogin DESC");
	$qr= mysql_fetch_row($q);
?>

<p><span class="newstitle"><strong>Users Active in the Last 24 Hours (<?php echo $qr[0]; ?>)</strong></span>
  <?php
	$q = mysql_query("SELECT * FROM ".$dbprefix."users WHERE lastlogin > " . (time() - 86400) . " ORDER BY lastlogin DESC");
?>
</p>
<table width="100%" border="0" cellpadding="1" cellspacing="0" class="smallprint">
  <tr class="display">
    <td width="42"><strong>#</strong></td>
    <td width="100"><strong>Username</strong></td>
    <td width="180"><strong>Last Logged In</strong></td>
    <td><strong>Website</strong></td>
  </tr>
  <?php

  	while ($row = mysql_fetch_array($q)) {
		//echo "<a href=\"profile.php?uid=$row[user_id]\">$row[username]</a> Website: <a href=\"$row[website]\">$row[website]</a> (level $row[level])<br>";


 		echo "<tr class=\"display\">";
    	echo "<td>$row[user_id]</td>";
		echo "<td><a href=\"profile.php?uid=$row[user_id]\">$row[username]</a> </td>";
		echo "<td>" . date("d F Y", $row[lastlogin]) . "</strong> at <strong>". date("H:i", $row[lastlogin]) . "</td>";
		echo "<td><a href=\"$row[website]\">$row[website]</a></td>";
		echo "</tr>";
  	}

  ?>
</table>
<p><font size="3"><strong><br>
      <span class="newstitle">New (40)</span> </strong></font>
  <?php
	$q = mysql_query("SELECT * FROM ".$dbprefix."users ORDER BY user_id DESC  LIMIT 0,40");
?>
</p>
<table width="100%" border="0" cellpadding="1" cellspacing="0" class="smallprint">
  <tr class="display">
    <td width="42"><strong>#</strong></td>
    <td width="100"><strong>Username</strong></td>
    <td width="180"><strong>Last Logged In</strong></td>
    <td><strong>Website</strong></td>
  </tr>
  <?php

  	while ($row = mysql_fetch_array($q)) {
		//echo "<a href=\"profile.php?uid=$row[user_id]\">$row[username]</a> Website: <a href=\"$row[website]\">$row[website]</a> (level $row[level])<br>";


 		echo "<tr class=\"display\">";
    	echo "<td>$row[user_id]</td>";
		echo "<td><a href=\"profile.php?uid=$row[user_id]\">$row[username]</a> </td>";
		echo "<td>" . date("d F Y", $row[lastlogin]) . "</strong> at <strong>". date("H:i", $row[lastlogin]) . "</td>";
		echo "<td><a href=\"$row[website]\">$row[website]</a></td>";
		echo "</tr>";
  	}

  ?>
</table>
<?php include('tmpl_foot.php'); ?>
Return current item: Open ShareLive