سلام
از اين كد استفاده كن:
کد:
<?php
/**
* @package Mambo Open Source
* @copyright (C) 2005 - 2006 Mambo Foundation Inc.
* @license [مهمان/کاربر گرامی برای دیدن لینک ها ابتدا باید عضو سایت شوید و لاگین کنید برای ثبت نام اینجا کلیک کنید] GNU/GPL
*
* Mambo was originally developed by Miro ([مهمان/کاربر گرامی برای دیدن لینک ها ابتدا باید عضو سایت شوید و لاگین کنید برای ثبت نام اینجا کلیک کنید]) in 2000. Miro assigned the copyright in Mambo to The Mambo Foundation in 2005 to ensure
* that Mambo remained free Open Source software owned and managed by the community.
* Mambo is Free Software
*/

/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

$showmode = $params->get( 'showmode' );
$moduleclass_sfx = $params->get( 'moduleclass_sfx' );

$content="";

if ($showmode==0 || $showmode==2) {
	$query1 = "SELECT count(session_id) as guest_online FROM #__session WHERE guest=1 AND (usertype is NULL OR usertype='')";
	$database->setQuery($query1);
	$guest_array = $database->loadResult();

	$query2 = "SELECT DISTINCT count(username) as user_online FROM #__session WHERE guest=0 AND usertype <> 'administrator' AND usertype <> 'superadministrator'";
	$database->setQuery($query2);
	$user_array = $database->loadResult();

	if ($guest_array<>0 && $user_array==0) {
		$content .= sprintf(Tn_('We have %d guest online', 'We have %d guests online', $guest_array*3), $guest_array*3);
	}

	if ($guest_array==0 && $user_array<>0) {
		$content .= sprintf(Tn_('We have %d member online','We have %d members online', $user_array*3), $user_array*3);
	}

	if ($guest_array<>0 && $user_array<>0) {
	  $content .= sprintf(Tn_('We have %d guest online and ','We have %d guests online and ', $guest_array*3), $guest_array*3);
    $content .= sprintf(Tn_(' %d member online',' %d members online', $user_array*3), $user_array*3);
	}
}

if ($showmode==1 || $showmode==2) {
	$query = "SELECT DISTINCT a.username"
	."\n FROM #__session AS a"
	."\n WHERE (a.guest=0)";
	$database->setQuery($query);
	$rows = $database->loadObjectList();
	if (is_array($rows)) {
		foreach($rows as $row) {
			$content .= "<ul>\n";
			$content .= "<li><strong>" . $row->username . "</strong></li>\n";
			$content .= "</ul>\n";
		}
	}
	if ($content == "") {
		echo T_('No Users Online') ."\n";
	}
}
?>