Location: PHPKode > projects > PHPFreeNews > phpfn/Inc/ActiveUsers.php
<?php

/*	+--------------------------------------------------------------
	| PHPFreeNews - News Headlines on your website                |
	| Developed by Jim Willsher.                                  |
	| http://www.phpfreenews.co.uk                                |
	+-------------------------------------------------------------+
*/

if (! defined('IN_PHPFN'))
	die('Illegal attempt to access script directly!');

CheckAuthority();

$Query = "SELECT * FROM news_users WHERE (now() - LastActivityDateTime < $ActiveUsersThreshold) ORDER BY LastActivityDateTime DESC";
$ResultSet = mysql_query($Query);

// Display the heading
DisplayGroupHeading('Active Users');
?>

		<br />
		<br />
		<table align="center" border="1" width="90%" cellspacing="0" cellpadding="3">
			<tr>
				<td><b>User</b> </td>
				<td><b>Activity</b> </td>
				<td><b>Date/Time</b> </td>
			</tr>
			<?php
		while ($Row = mysql_fetch_array($ResultSet))
		{
			$FullName = $Row['FullName'];
			$LastActivityDateTime = date($NewsDisplay_DateFormat, strtotime($Row['LastActivityDateTime'])) . '&nbsp;' . date($NewsDisplay_TimeFormat, strtotime($Row['LastActivityDateTime']));

			$ActivityDesc = '';
			switch ($Row['LastActivity'])
			{
				case 'Logout' :
					$ActivityDesc = 'Logging Out';
					break;

				case 'Statistics' :
					$ActivityDesc = 'Viewing Statistics';
					break;

				case 'ActiveUsers' :
					$ActivityDesc = 'Viewing Active Users';
					break;

				case 'NewsList' :
					$ActivityDesc = 'Viewing Articles';
					break;

				case 'CommentsApproval' :
					$ActivityDesc = 'Approving Comments';
					break;

				case 'postsapproval' :
					$ActivityDesc = 'Approving Posts';
					break;

				case 'news' :
					$ActivityDesc = 'Posting News';
					break;

				case 'ImageList' :
					$ActivityDesc = 'Maintaining Images';
					break;

				case 'Users' :
					$ActivityDesc = 'Maintaining Users';
					break;

				case 'Password' :
					$ActivityDesc = 'Changing Password';
					break;

				case 'Categories' :
					$ActivityDesc = 'Maintaining Categories';
					break;

				case 'Templates' :
					$ActivityDesc = 'Maintaining Templates';
					break;

				case 'UserCodes' :
					$ActivityDesc = 'Maintaining User-defined Codes';
					break;

				case 'PurgeNews' :
					$ActivityDesc = 'Purging News';
					break;

				case 'PurgeAudit' :
					$ActivityDesc = 'Purging Audit';
					break;

				case 'Archive' :
					$ActivityDesc = 'Archiving News';
					break;

				case 'Audit' :
					$ActivityDesc = 'Viewing Audit';
					break;

				case 'DoSticky' :
					$ActivityDesc = 'Changing Sticky Status';
					break;

				case 'DoVisible' :
					$ActivityDesc = 'Changing Visible Status';
					break;

				case 'DoLock' :
					$ActivityDesc = 'Changing Locked Status';
					break;

				case 'VersionCheck' :
					$ActivityDesc = 'Checking for New Release';
					break;

				case 'Mass' :
					$ActivityDesc = 'Mass Maintenance';
					break;

				case 'UserAuthCat' :
					$ActivityDesc = 'Authorising User to Categories';
					break;

				case 'CatAuthUser' :
					$ActivityDesc = 'Authorising Users to Category';
					break;

				default:
					$ActivityDesc = 'Unknown?!!!';
					break;
			}

			?>
			<tr>
				<td><?= $FullName ?>
				</td>
				<td><?= $ActivityDesc ?>
				</td>
				<td><?= $LastActivityDateTime ?>
				</td>
			</tr>
			<?
		}
		?>
		</table>
Return current item: PHPFreeNews