summaryrefslogtreecommitdiff
path: root/www-ssl/inc/funktion_activeUser.php
blob: b5d66d8aaecc476a50d8563dc71f1d50b869598e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?PHP

// Functionen gibt es nicht auf ellen rechern
if( !function_exists("bcdiv"))
{
	function bcdiv( $param1, $param2)
	{
		return floor( $param1 / $param2);
	}
}

if( !function_exists("bcmod"))
{
	function bcmod( $param1, $param2)
	{
		return $param1 - ( $param2 * bcdiv( $param1, $param2));
	}
}


echo "<h4 class=\"menu\">Engels Online</h4>";

$SQL = "SELECT Nick, lastLogIn ".
	"FROM User ".
	"WHERE (`lastLogIn` > '". gmdate("YmdHis", time()-(60*60)). "' AND NOT (UID=". $_SESSION['UID']. ")) ".
	"ORDER BY lastLogIn DESC;";

$Erg = mysql_query( $SQL, $con);
	

$Tist =	(gmdate("d", time()) * 60 * 60 * 24) +	// Tag
	(gmdate("H", time()) * 60 * 60) +	// Stunde
	(gmdate("i", time()) * 60) +		// Minute
	(gmdate("s", time()) ); 		// Sekunde

for( $i=0; $i<mysql_num_rows($Erg); $i++)
{
	echo "\t\t\t<li>";
	echo mysql_result( $Erg, $i, "Nick");
	$Tlog =	(substr( mysql_result( $Erg, $i, "lastLogIn"),  8, 2) * 60 * 60 * 24) +	// Tag
		(substr( mysql_result( $Erg, $i, "lastLogIn"), 11, 2) * 60 * 60) +	// Stunde
		(substr( mysql_result( $Erg, $i, "lastLogIn"), 14, 2) * 60) +		// Minute
		(substr( mysql_result( $Erg, $i, "lastLogIn"), 17, 2) );		// Sekunde
	
 	$Tlog = $Tist-$Tlog;
	echo " ". bcdiv( $Tlog, 60). ":";
	if( strlen(bcmod( $Tlog, 60))==1)
		echo "0";
	echo bcmod( $Tlog, 60);
	echo "</li>\n";
}

?>