begin_block("Stats"); //main stats here $a = @mysql_fetch_assoc(@mysql_query("SELECT id,username FROM users WHERE status='confirmed' ORDER BY id DESC LIMIT 1")); if ($CURUSER) $latestuser = "" . $a["username"] . ""; else $latestuser = "$a[username]"; $registered = number_format(get_row_count("users")); $torrents = number_format(get_row_count("torrents")); $result = mysql_query("SELECT SUM(downloaded) AS totaldl FROM users") or sqlerr(__FILE__, __LINE__); while ($row = mysql_fetch_array ($result)) { $totaldownloaded = $row["totaldl"]; } $result = mysql_query("SELECT SUM(uploaded) AS totalul FROM users") or sqlerr(__FILE__, __LINE__); while ($row = mysql_fetch_array ($result)) { $totaluploaded = $row["totalul"]; } $seeders = get_row_count("peers", "WHERE seeder='yes'"); $leechers = get_row_count("peers", "WHERE seeder='no'"); $usersactive = 0; if ($leechers == 0) $ratio = "100"; else $ratio = round($seeders / $leechers * 100); if ($ratio < 20) $ratio = "" . $ratio . "%"; else $ratio .= "%"; $peers = number_format($seeders + $leechers); $seeders = number_format($seeders); $leechers = number_format($leechers); //start count visited today $res = mysql_query("SELECT COUNT(*) FROM users WHERE UNIX_TIMESTAMP(" . get_dt_num() . ") - UNIX_TIMESTAMP(last_access) < 86400"); $arr3 = mysql_fetch_row($res); $totaltoday = $arr3[0]; // start count registered today $res = mysql_query("SELECT COUNT(*) FROM users WHERE UNIX_TIMESTAMP(" . get_dt_num() . ") - UNIX_TIMESTAMP(added) < 86400"); $arr44 = mysql_fetch_row($res); $regtoday = $arr44[0]; //start count online now $res = mysql_query("SELECT COUNT(*) FROM users WHERE UNIX_TIMESTAMP(" . get_dt_num() . ") - UNIX_TIMESTAMP(last_access) < 900"); $arr4 = mysql_fetch_row($res); $totalnow = $arr4[0]; if ($CURUSER) guestadd(); if (!$activepeople) $activepeople = "" . NO_USERS . ""; if (!$todayactive) $todayactive = "" . NO_USERS . ""; $guests = getguests(); if (!$guests) $guests = "0"; $time_start = getmicrotime(); //end here stdhead(); begin_frame("" . STATS . "", center); echo "
" . WELCOME_NEW . ": " . $latestuser . "
"; if (!$activepeople) echo "
" . ONLINE_USERS . ": (" . $totalnow . ")0 Members"; else echo "
" . ONLINE_USERS . ": (" . $totalnow . ")"; $totalusers = $totalnow + $guests; echo "
" . GUESTS_ONLINE . ": (" . $guests . ")"; echo "
" . TOTAL_ONLINE . ": (" . $totalusers . ")"; if (!$todayactive) echo "
" . VISITORS_TODAY . ": (" . $totaltoday . ")
0 Members
"; else echo "
" . VISITORS_TODAY . ": (" . $totaltoday . ")"; echo "
" . TOTAL_USERS . ": " . $registered . ""; echo "
" . NEWUSERS_TODAY . ": " . $regtoday . ""; echo "
" . ACTIVE_TRANSFERS . ": " . $peers . ""; ECHO "
" . DOWNLOADED . ": " . mksize($totaldownloaded) . ""; ECHO "
" . UPLOADED . ": " . mksize($totaluploaded) . ""; echo "
" . TRACKING . " " . $torrents . " Torrents"; echo "
" . SEEDS . ": " . $seeders . ""; echo "
" . LEECH . ": " . $leechers . ""; echo "
" . SEED_RATIO . ": " . $ratio . ""; echo "

"; end_frame(); end_block();