X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=stats.php;h=efd2c216fcb1fb54f2cd26bcd0c17c48d5758917;hp=bab9823aa163c4114c527c60226dd13b96b8beb1;hb=2a95396715b96617efcc4f167352581b8ef0d688;hpb=acf6c5f97944366952e6b373a4d59cecd08b658e;ds=sidebyside diff --git a/stats.php b/stats.php index bab9823..efd2c21 100644 --- a/stats.php +++ b/stats.php @@ -29,7 +29,7 @@ if(myisset("logout")) session_destroy(); $_SESSION = array(); echo "
You are now logged out!
\n". - "(This will take you back to the home-page)
"; + "(This will take you back to the home-page)"; } /* user status page */ else if( isset($_SESSION["name"]) ) @@ -155,8 +155,11 @@ else if( isset($_SESSION["name"]) ) } /* most reminders */ - echo "

These players got the most reminders:
\n"; - $result = mysql_query("SELECT COUNT(*) as c,fullname from Reminder". + echo "

These players got the most reminders per game:
\n"; + $result = mysql_query("SELECT COUNT(*) /" . + " (SELECT COUNT(*) FROM Hand". + " WHERE user_id=User.id) as c,". + " fullname FROM Reminder". " LEFT JOIN User ON User.id=user_id". " GROUP BY user_id". " ORDER BY c DESC LIMIT 3" ); @@ -165,22 +168,30 @@ else if( isset($_SESSION["name"]) ) echo "

\n"; /* fox */ - echo "

These players caught the most foxes:
\n"; - $result = mysql_query("SELECT COUNT(*) as c,fullname from Score". + echo "

These players caught the most foxes per game:
\n"; + $result = mysql_query("SELECT COUNT(*) /" . + " (SELECT COUNT(*) FROM Hand". + " WHERE user_id=User.id) as c,". + " fullname". + " FROM Score". " LEFT JOIN User ON User.id=winner_id". " WHERE score='fox'". " GROUP BY winner_id". - " ORDER BY c DESC LIMIT 2" ); + " ORDER BY c DESC LIMIT 5" ); while( $r = mysql_fetch_array($result,MYSQL_NUM)) echo $r[1]." (".$r[0].")
\n"; echo "

\n"; - echo "

These players lost their fox most often:
\n"; - $result = mysql_query("SELECT COUNT(*) as c,fullname from Score". + echo "

These players lost their fox most often per game:
\n"; + $result = mysql_query("SELECT COUNT(*) /" . + " (SELECT COUNT(*) FROM Hand". + " WHERE user_id=User.id) as c,". + " fullname". + " FROM Score". " LEFT JOIN User ON User.id=looser_id". " WHERE score='fox'". " GROUP BY looser_id". - " ORDER BY c DESC LIMIT 2" ); + " ORDER BY c DESC LIMIT 5" ); while( $r = mysql_fetch_array($result,MYSQL_NUM)) echo $r[1]." (".$r[0].")
\n"; echo "

\n"; @@ -228,7 +239,7 @@ else if( isset($_SESSION["name"]) ) { /* send them back to the login page */ echo "
You need to log in!
\n". - "(This will take you back to the login-page)
"; + "(This will take you back to the login-page)"; } output_footer();