From da709b9dc03b5649d6aeae0ef33e2d9f4a3e4b6c Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Tue, 7 May 2002 09:44:08 +0000 Subject: [PATCH] Rough statistics table (enabled with -s switch). --- exec/nodelist-html.js | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/exec/nodelist-html.js b/exec/nodelist-html.js index 82834a03f5..a69c2865b5 100644 --- a/exec/nodelist-html.js +++ b/exec/nodelist-html.js @@ -9,6 +9,7 @@ load("nodedefs.js"); var include_age_gender=true; var include_location=false; +var include_statistics=false; // Parse arguments for(i=0;i<argc;i++) @@ -22,6 +23,9 @@ for(i=0;i<argc;i++) case "-l": include_location=true; break; + case "-s": /* statistics */ + include_statistics=true; + break; } // Write a string to the client socket @@ -72,13 +76,45 @@ writeln("</td>"); writeln("</tr>"); writeln("</table>"); +font_color = "<font color=black>"; + +if(include_statistics) { + total = time()-system.uptime; + days = Math.floor(total/(24*60*60)); + if(days) + total%=(24*60*60); + hours = Math.floor(total/(60*60)); + min = (Math.floor(total/60))%60; + sec = total%60; + + // Table + writeln("<table border=1 width=100%>"); + writeln("<td>Up Time<td>" + + format("%u days, %u:%02u:%02u",days,hours,min,sec)); + writeln("<td>Logons Today<td>" + system.stats.logons_today); + writeln("<td>Posts Today<td>" + system.stats.messages_posted_today); + writeln("<td>Uploads Today<td>" + + format("%lu bytes in %lu files" + ,system.stats.bytes_uploaded_today + ,system.stats.files_uploaded_today)); + writeln("<tr>"); + writeln("<td>Time-on Today<td>" + system.stats.timeon_today); + writeln("<td>New Users Today<td>" + system.stats.new_users_today); + writeln("<td>Emails Today<td>" + system.stats.email_sent_today); + writeln("<td>Downloads Today<td>" + + format("%lu bytes in %lu files" + ,system.stats.bytes_downloaded_today + ,system.stats.files_downloaded_today)); + writeln("</table>"); + writeln("<br>"); +} + // Table writeln("<table border=0 width=100%>"); // Header writeln("<thead>"); writeln("<tr bgcolor=white>"); -font_color = "<font color=black>"; write(format("<th align=center width=7%>%sNode",font_color)); write(format("<th align=center width=20%>%sUser",font_color)); -- GitLab