online.php

来自「本代码是为客户联系管理而做的系统」· PHP 代码 · 共 71 行

PHP
71
字号
<?php
// +-------------------------------------------------------------+
// | DeskPRO v [2.0.1 Production]
// | Copyright (C) 2001 - 2004 Headstart Solutions Limited
// | Supplied by WTN-WDYL
// | Nullified by WTN-WDYL
// | Distribution via WebForum, ForumRU and associated file dumps
// +-------------------------------------------------------------+
// | DESKPRO IS NOT FREE SOFTWARE
// +-------------------------------------------------------------+
// | License ID : Full Enterprise License =) ...
// | License Owner : WTN-WDYL Team
// +-------------------------------------------------------------+
// | $RCSfile: online.php,v $
// | $Date: 2004/02/10 01:34:32 $
// | $Revision: 1.12 $
// +-------------------------------------------------------------+
// | File Details:
// | - User activity viewer.
// +-------------------------------------------------------------+

error_reporting(E_ALL ^ E_NOTICE);


include "./../global.php";

tech_nav('users');

############################### USERS ONLINE ###############################

// delete old sessions
$time = mktime() - $settings[session_length];

$db->query("DELETE FROM user_session 
			WHERE lastactivity < '$time'
		");

$db->query('SELECT username, id FROM user');
while ($result = $db->row_array()) {
	$users[$result[id]] = $result[username];
}

$db->query('SELECT userid, location, lastactivity
	FROM user_session
	ORDER BY lastactivity, userid');

while ($result = $db->row_array()) {
	$table[] = array(
		iff($result[userid], "<A HREF=\"view.php?id=$result[userid]\">".$users[$result[userid]]."</A>", '<I>Guest</I>'),
		date('r', $result[lastactivity]),
		iff($result[location], $result[location], '<I>Not available</I>')
	);
}

echo "<br /><center>" . thelp('Users', 'Online Users') . '</center>';
if (is_array($table)) {
	array_unshift($table, array(
		'<B>Username</B>',
		'<B>Last Activity</B>',
		'<B>Current Location</B>')
	);
	table_header('Users Online');
	table_content('', $table);
	table_footer();
} else {
	echo "<br /><br /><center><b>No users are currently online.</b></center>";
}

tech_footer();
?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?