session_unset();
session_destroy();
$_SESSION = array();
- echo "you are now logged out!";
+ echo "<div class=\"message\"><span class=\"bigger\">You are now logged out!</span><br />\n".
+ "(<a href=\"$INDEX\">This will take you back to the home-page</a>)</div>";
}
/* user status page */
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);
if($ok)
{
- DB_get_PREF($myid);
-
- $time = DB_get_user_timestamp($myid);
- $unixtime = strtotime($time);
+ output_status();
- $offset = DB_get_user_timezone($myid);
- $zone = return_timezone($offset);
- date_default_timezone_set($zone);
-
- output_status($name);
-
- echo "<div class=\"lastlogin\">last login: ".date("r",$unixtime)."</div>";
+ DB_get_PREF($myid);
DB_update_user_timestamp($myid);
" AND Game.status='gameover'");
while( $r = mysql_fetch_array($result,MYSQL_NUM))
echo $r[0];
- echo " games</p>\n";
+ echo " games.</p>\n";
/* number of solos */
select id,type,solo,status from game where id in (select id from game where randomnumbers in (select randomnumbers from game where id=27));
*/
- echo "<p>Most extra points (doko, fox, karlchen) in a game::<br />\n";
+ echo "<p>Most extra points (doko, fox, karlchen) in a single game:<br />\n";
$result = mysql_query("SELECT COUNT(*) as c,fullname FROM Score".
" LEFT JOIN User ON User.id=winner_id" .
" WHERE score IN ('fox','doko','karlchen')".
echo "</p>\n";
/* longest and shortest game */
- $r=mysql_query("SELECT MIN(datediff(mod_date,create_date)),session".
- " 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);
- echo "<p> The shortest game took only ".$short[0]." days.<br />\n";
+ $names = DB_get_all_names_by_gameid($short[2]);
+ echo "<p> The shortest game took only ".$short[0]." hours and was played by ".join(", ",$names).".<br />\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);
echo "The longest game took ".$long[0]." days.</p>\n";
}
+ $r=mysql_query("SELECT COUNT(*) as c, session, id FROM Game ".
+ " GROUP BY session ORDER BY c DESC LIMIT 1");
+ if($r)
+ {
+ $long = mysql_fetch_array($r,MYSQL_NUM);
+ $names = DB_get_all_names_by_gameid($long[2]);
+ echo "The longest session is session ".$long[1]." with ".$long[0].
+ " games played by ".join(", ",$names).".</p>\n";
+ }
+
/* most reminders */
echo "<p>These players got the most reminders:<br />\n";
$result = mysql_query("SELECT COUNT(*) as c,fullname from Reminder".
else
{
/* send them back to the login page */
- echo "<p>Please log in</p>";
+ echo "<div class=\"message\"><span class=\"bigger\">You need to log in!</span><br />\n".
+ "(<a href=\"$INDEX\">This will take you back to the login-page</a>)</div>";
}
output_footer();