summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--create_database.sql1
-rw-r--r--db.php22
-rw-r--r--index.php16
3 files changed, 35 insertions, 4 deletions
diff --git a/create_database.sql b/create_database.sql
index 396862d..e863f53 100644
--- a/create_database.sql
+++ b/create_database.sql
@@ -269,6 +269,7 @@ CREATE TABLE `User` (
`password` varchar(32) default NULL,
`timezone` varchar(64) default 'Europe/London',
`last_login` timestamp NOT NULL default '0000-00-00 00:00:00',
+ `create_date` timestamp NOT NULL default '0000-00-00 00:00:00',
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
diff --git a/db.php b/db.php
index 39ab45c..7b95ae7 100644
--- a/db.php
+++ b/db.php
@@ -578,6 +578,28 @@ function DB_get_all_names()
return $names;
}
+function DB_get_names_of_last_logins($N)
+{
+ $names = array();
+
+ $result = mysql_query("SELECT fullname FROM User ORDER BY last_login DESC LIMIT $N");
+ while($r = mysql_fetch_array($result,MYSQL_NUM))
+ $names[] = $r[0];
+
+ return $names;
+}
+
+function DB_get_names_of_new_logins($N)
+{
+ $names = array();
+
+ $result = mysql_query("SELECT fullname FROM User ORDER BY create_date DESC, id DESC LIMIT $N");
+ while($r = mysql_fetch_array($result,MYSQL_NUM))
+ $names[] = $r[0];
+
+ return $names;
+}
+
function DB_update_game_timestamp($gameid)
{
mysql_query("UPDATE Game SET mod_date = CURRENT_TIMESTAMP WHERE id=".DB_quote_smart($gameid));
diff --git a/index.php b/index.php
index 4b5ca5c..c3988b5 100644
--- a/index.php
+++ b/index.php
@@ -2248,10 +2248,18 @@ else if( myisset("email","password") || isset($_SESSION["name"]) )
}
}
echo "</td></tr>\n</table>\n";
- $names = DB_get_all_names();
- echo "<h4>Registered players:</h4>\n<p>\n";
- echo implode(", ",$names)."\n";
- echo "</p>\n</div>";
+
+ $names = DB_get_names_of_new_logins(5);
+ echo "<h4>New Players:</h4>\n<p>\n";
+ echo implode(", ",$names).",...\n";
+ echo "</p>\n";
+
+ $names = DB_get_names_of_last_logins(5);
+ echo "<h4>Players last logged in:</h4>\n<p>\n";
+ echo implode(", ",$names).",...\n";
+ echo "</p>\n";
+
+ echo "</div>\n";
}
}
else