<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2005 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
if (!defined("IN_FUSION")) { header("Location:../../index.php"); exit; }

if (file_exists(INFUSIONS."last_seen_users_panel/locale/".$settings['locale'].".php")) {
	include INFUSIONS."last_seen_users_panel/locale/".$settings['locale'].".php";
} else {
	include INFUSIONS."last_seen_users_panel/locale/English.php";
}

openside($locale['lsup000']);

[color=red]echo "[/color]<b><img src='".BASEDIR."/infusions/user_info_panel/images/4.gif'>Statistika:</b><br>";
$data = dbarray(dbquery("SELECT user_id,user_name FROM ".$db_prefix."users WHERE user_status='0' ORDER BY user_joined DESC LIMIT 0,1"));
echo "<span class='small'>°</span> ".$locale['on117']."<a href='".BASEDIR."profile.php?lookup=".$data['user_id']."' class='side' title='".$data['user_name']."'>".trimlink($data['user_name'], 12)."</a><br />\n";
$tag1= date('d');
$tag1= date('d');
$monat1= date('m');
$jahr1= date('Y');
$hanfang = mktime(0,0,0,$monat1,$tag1,$jahr1);
$hende = mktime(23,59,59,$monat1,$tag1,$jahr1);
$ganfang = mktime(0,0,0,$monat1,$tag1-1,$jahr1);
$gende = mktime(23,59,59,$monat1,$tag1-1,$jahr1);
echo "° Nauj¸ nari¸ vakar: ".dbcount("(user_id)", "users", "user_joined >='".$ganfang."' AND user_joined <='".$gende."'")."<br>";
echo "° Nauj¸ nari¸ &#240;iandien: ".dbcount("(user_id)", "users", "user_joined >='".$hanfang."' AND user_joined <='".$hende."'")."<br>";
echo "<span class='small'>°</span> ".$locale['on100'].number_format(dbcount("(user_id)", "users", "user_status<='1'"))."<br />\n";
$cond = ($userdata['user_level'] != 0 ? "'".$userdata['user_id']."'" : "'0' AND online_ip='".USER_IP."'");
$result = dbquery("SELECT * FROM ".$db_prefix."online WHERE online_user=".$cond."");
if (dbrows($result) != 0) {
$result = dbquery("UPDATE ".$db_prefix."online SET online_lastactive='".time()."' WHERE online_user=".$cond."");
} else {
$name = ($userdata['user_level'] != 0 ? $userdata['user_id'] : "0");
$result = dbquery("INSERT INTO ".$db_prefix."online VALUES('$name', '".USER_IP."', '".time()."')");

$result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_lastvisit>'0' AND user_status='0' ORDER BY user_lastvisit DESC LIMIT 0,10");
echo "<table cellpadding='0' cellspacing='0' width='100%'>";
if (dbrows($result) != 0) {
	while ($data = dbarray($result)) {
		$lastseen = time() - $data['user_lastvisit'];
		$iW=sprintf("%2d",floor($lastseen/604800));
		$iD=sprintf("%2d",floor($lastseen/(60*60*24)));
		$iH=sprintf("%02d",floor((($lastseen%604800)%86400)/3600));
		$iM=sprintf("%02d",floor(((($lastseen%604800)%86400)%3600)/60));
		$iS=sprintf("%02d",floor((((($lastseen%604800)%86400)%3600)%60)));
		if ($lastseen < 60){
			$lastseen= $locale['lsup001'];
		} elseif ($lastseen < 360){
			$lastseen= $locale['lsup002'];
		} elseif ($iW > 0){
			if ($iW == 1) { $text = $locale['lsup003']; } else { $text = $locale['lsup004']; }
			$lastseen = $iW." ".$text;
		} elseif ($iD > 0){
			if ($iD == 1) { $text = $locale['lsup005']; } else { $text = $locale['lsup006']; }
			$lastseen = $iD." ".$text;
		} else {
			$lastseen = $iH.":".$iM.":".$iS;
		}
		echo "<tr>\n<td class='side-small' align='left'><img src='".THEME."images/bullet.gif' alt=''>\n";
		echo "<a href='".BASEDIR."profile.php?lookup=".$data['user_id']."' title='".$data['user_name']."' class='side'>\n";
		echo trimlink($data['user_name'], 15)."</a></td><td class='side-small' align='right'>".$lastseen."</td>\n</tr>\n";
	}
}
echo "</table>";

[color=red]}[/color]

closeside();
?>