X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=stats.php;h=44378d455b479c6486da35803cfde2e87000ca06;hp=5bbca267f136609cbff7d288feca10926cbe2b4b;hb=9122cf59b57c7405a14b5a61238667b98dd58150;hpb=3db5eb27624bf78817a69da847af22f3986f20fe diff --git a/stats.php b/stats.php index 5bbca26..44378d4 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"]) ) @@ -38,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); @@ -50,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 "
last login: ".date("r",$unixtime)."
"; + DB_get_PREF($myid); DB_update_user_timestamp($myid); @@ -134,8 +124,10 @@ else if( isset($_SESSION["name"]) ) echo "

\n"; /* longest and shortest game */ - $r=mysql_query("SELECT MIN(timediff(mod_date,create_date)),session,id". - " FROM Game WHERE status='gameover' GROUP BY status"); + $r=mysql_query("SELECT timediff(mod_date,create_date) ,session,id". + " FROM Game WHERE status='gameover'". + " ORDER BY time_to_sec(timediff(mod_date,create_date)) ASC LIMIT 1"); + if($r) { $short= mysql_fetch_array($r,MYSQL_NUM); @@ -143,8 +135,9 @@ else if( isset($_SESSION["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); @@ -235,7 +228,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();