LMS id do mesicnich a rocnich statistik
authorxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Sun, 20 Nov 2011 23:20:33 +0000 (23:20 +0000)
committerxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Sun, 20 Nov 2011 23:20:33 +0000 (23:20 +0000)
git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@148 251d49ef-1d17-4917-a970-b30cf55b089b

prometheus.c

index 3cc2662a6cf648d097091004d514a87c424d857c..5a0939fc8e1bb265e3cddb5266c256d1241447bf 100644 (file)
@@ -646,7 +646,7 @@ void run_restore(void)
 \r
 /* == This function strips extra characters after IP address and stores it = */\r
 \r
 \r
 /* == This function strips extra characters after IP address and stores it = */\r
 \r
-void parse_ip(char *str)\r
+void parse_ip(struct IP *ip, char *str)\r
 {\r
  char *ptr,*ipaddr=NULL,*ipname=NULL,*lmsid=NULL;\r
 \r
 {\r
  char *ptr,*ipaddr=NULL,*ipname=NULL,*lmsid=NULL;\r
 \r
@@ -839,20 +839,30 @@ void parse_ip_log(int argc, char **argv)
  f=fopen(str,"w");\r
  if(f)\r
  {\r
  f=fopen(str,"w");\r
  if(f)\r
  {\r
-  fprintf(f,"<table border><tr><th colspan=\"2\">%s %s</th><th colspan=\"2\">Data transfers</th><th align=\"right\">Min.speed</th></tr>\n ",month,year);\r
+  fprintf(f,"<table border><tr><th colspan=\"2\">%s %s</th><th align=\"right\">lms</th><th colspan=\"2\">Data transfers</th><th align=\"right\">Min.speed</th></tr>\n ",month,year);\r
 \r
   for_each(iplog,iplogs)\r
   {\r
    if(iplog->traffic)\r
    {\r
 \r
   for_each(iplog,iplogs)\r
   {\r
    if(iplog->traffic)\r
    {\r
-    fprintf(f,"<tr><td align=\"right\">%d</td><th align=\"left\">%s</td><td align=\"right\">%ld M</td><th align=\"right\">%ld G</th><td align=\"right\">%ld kbps</th></tr>\n",\r
-              i++, iplog->name, iplog->traffic, iplog->traffic>>10, iplog->guaranted);\r
+    fprintf(f,"<tr><td align=\"right\">%d</td><th align=\"left\">%s</td><td align=\"right\">", i++, iplog->name); \r
+    if(iplog->lmsid > 0)\r
+    {\r
+     /*base URL will be configurable soon ... */\r
+     fprintf(f,"<a href=\"https://hermes.spoje.net/?m=customerinfo&amp;id=%d\">%04d</a>\n", iplog->lmsid, iplog->lmsid);\r
+    }\r
+    else if(iplog->lmsid == 0)\r
+    {\r
+     fputs("-------",f);\r
+    }    \r
+    fprintf(f,"<td align=\"right\">%ld M</td><th align=\"right\">%ld G</th><td align=\"right\">%ld kbps</th></tr>\n",\r
+              iplog->traffic, iplog->traffic>>10, iplog->guaranted);\r
     total+=iplog->traffic>>10;\r
     iplog->i=i;\r
     iplog->l=total;\r
    }\r
   }\r
     total+=iplog->traffic>>10;\r
     iplog->i=i;\r
     iplog->l=total;\r
    }\r
   }\r
-  fprintf(f,"<tr><th colspan=\"3\" align=\"left\">Total:</th><th align=\"right\">%ld GB</th><th align=\"right\">%Ld kbps</th></tr>\n", total, line);\r
+  fprintf(f,"<tr><th colspan=\"4\" align=\"left\">Total:</th><th align=\"right\">%ld GB</th><th align=\"right\">%Ld kbps</th></tr>\n", total, line);\r
   fputs("</table>\n", f);\r
 \r
   if(i>10)\r
   fputs("</table>\n", f);\r
 \r
   if(i>10)\r
@@ -1023,7 +1033,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
   if(substring)\r
   { \r
    substring+=8; //"sharing-"\r
   if(substring)\r
   { \r
    substring+=8; //"sharing-"\r
-   parse_ip(str);\r
+   parse_ip(ip, str);\r
    ip_count++;\r
    ip->sharing=substring;\r
    ip->keyword=defaultkeyword; /* settings for default keyword */\r
    ip_count++;\r
    ip->sharing=substring;\r
    ip->keyword=defaultkeyword; /* settings for default keyword */\r
@@ -1039,7 +1049,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
 \r
    if_exists(keyword,keywords,(substring=strstr(str,keyword->key)))\r
    {\r
 \r
    if_exists(keyword,keywords,(substring=strstr(str,keyword->key)))\r
    {\r
-    parse_ip(str);\r
+    parse_ip(ip, str);\r
     ip_count++;\r
     ip->keyword=keyword;\r
     keyword->ip_count++;\r
     ip_count++;\r
     ip->keyword=keyword;\r
     keyword->ip_count++;\r
@@ -1606,7 +1616,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
     }\r
     else if(ip->lmsid == 0)\r
     {\r
     }\r
     else if(ip->lmsid == 0)\r
     {\r
-     fputs("------",f);\r
+     fputs("-------",f);\r
     }\r
     fputs("</td>\n",f);    \r
    }\r
     }\r
     fputs("</td>\n",f);    \r
    }\r
This page took 0.123569 seconds and 4 git commands to generate.