X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=stats.php;h=efd2c216fcb1fb54f2cd26bcd0c17c48d5758917;hp=21b67ed3a7f8242a1d27e5f12711fa7f2fd05285;hb=2a95396715b96617efcc4f167352581b8ef0d688;hpb=c7f38cf790f4fa7b5ded66377dc9d79577a93c4e diff --git a/stats.php b/stats.php index 21b67ed..efd2c21 100644 --- a/stats.php +++ b/stats.php @@ -28,7 +28,8 @@ if(myisset("logout")) session_unset(); session_destroy(); $_SESSION = array(); - echo "you are now logged out!"; + echo "
"; } /* user status page */ else if( isset($_SESSION["name"]) ) @@ -37,7 +38,6 @@ else if( isset($_SESSION["name"]) ) $email = DB_get_email_by_name($name); $password = DB_get_passwd_by_name($name); - /* verify password and email */ if(strlen($password)!=32) $password = md5($password); @@ -49,18 +49,9 @@ else if( isset($_SESSION["name"]) ) if($ok) { - DB_get_PREF($myid); - - $time = DB_get_user_timestamp($myid); - $unixtime = strtotime($time); - - $offset = DB_get_user_timezone($myid); - $zone = return_timezone($offset); - date_default_timezone_set($zone); + output_status(); - output_status($name); - - echo " The shortest game took only ".$short[0]." hours and was played by ".join(", ",$names).".
\n";
}
- $r=mysql_query("SELECT MAX(datediff(mod_date,create_date)),session".
- " FROM Game where status='gameover' GROUP BY status");
+ $r=mysql_query("SELECT datediff(mod_date,create_date) ,session,id".
+ " FROM Game WHERE status='gameover'".
+ " ORDER BY time_to_sec(timediff(mod_date,create_date)) DESC LIMIT 1");
if($r)
{
$long= mysql_fetch_array($r,MYSQL_NUM);
@@ -161,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" );
@@ -171,22 +168,30 @@ else if( isset($_SESSION["name"]) )
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 "
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 "
Please log in
"; + echo " "; } output_footer();