wo ist die Topliste
Trampi das Trampeltier will es auch wissen
-
Strolch -
25. April 2007 um 00:23 -
Geschlossen
-
-
- Offizieller Beitrag
hier
PHP
Alles anzeigen<? require("global.php"); // punkte $result = $db->query("SELECT COUNT(bb".$n."_hangman.winnerid) AS punkte, bb".$n."_users.userid, bb".$n."_users.username FROM bb".$n."_hangman LEFT JOIN bb".$n."_users ON (bb".$n."_users.userid = bb".$n."_hangman.winnerid) WHERE bb".$n."_hangman.winnerid!='0' GROUP BY bb".$n."_hangman.winnerid ORDER BY punkte DESC LIMIT 0, 20"); $row = $db->fetch_array($result); $top = $row[punkte]; $i=1; $rank=1; $last = 0; do { if($top) { $percent_float = $row[punkte]*100/$top; $percent = number_format($percent_float, 2); $percent_int = floor($percent_float)*3; $percent_int += 1; } else $percent = $percent_int = 0; $tmp=$rank; if ($last==$row[punkte]) { $rank=" "; } if (!$row[username]) { $row[username] = "(gelöschter User)"; $row[userid] = 0; } eval ("\$toplist_linebit_1 .= \"".$tpl->get("toplist_linebit")."\";"); $rank = $tmp; if($i==5) $i=0; $i++; $rank++; $last=$row[punkte]; } while ($row = $db->fetch_array($result)); // erfolgsquote $result = $db->query("SELECT COUNT(bb".$n."_hangmandata.userid) as played, bb".$n."_users.userid FROM bb".$n."_hangmandata LEFT JOIN bb".$n."_users USING (userid) WHERE bb".$n."_users.userid!='0' GROUP BY bb".$n."_hangmandata.userid"); while ($row = $db->fetch_array($result)) { $played[$row['userid']] = $row['played']; } $result = $db->query("SELECT COUNT(bb".$n."_hangman.winnerid) as won, bb".$n."_users.userid, bb".$n."_users.username FROM bb".$n."_hangman LEFT JOIN bb".$n."_users ON (bb".$n."_users.userid = bb".$n."_hangman.winnerid) WHERE bb".$n."_hangman.winnerid!='0' GROUP BY bb".$n."_hangman.winnerid"); while ($row = $db->fetch_array($result)) { if ($played[$row['userid']]) { $ratio[$row['userid']] = round($row['won'] / $played[$row['userid']], 2); $name[$row['userid']] = $row['username']; } } arsort($ratio); $rank = 1; $i = 1; foreach ($ratio as $userid => $punkte) { $punkte *= 100; $percent_float = $punkte; $percent = number_format($percent_float, 2); $percent_int = floor($percent_float)*3; $percent_int += 1; $row[userid] = $userid; $row[username] = $name[$userid]; $row[punkte] = $punkte; if (!$name[$userid]) { $row[username] = "(gelöschter User)"; $row[userid] = 0; } eval ("\$toplist_linebit_2 .= \"".$tpl->get("toplist_linebit")."\";"); if($i==5) $i=0; $i++; $rank++; if ($rank > 20) break; } eval ("\$tpl->output(\"".$tpl->get("toplist")."\");"); ?>