2 * AUTHOR: Pedro Lineu Orso pedro.orso@gmail.com
4 * SARG Squid Analysis Report Generator http://sarg.sourceforge.net
7 * please look at http://sarg.sourceforge.net/donations.php
8 * ---------------------------------------------------------------------
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
26 #include "include/conf.h"
27 #include "include/defs.h"
32 FILE *fp_in
= NULL
, *fp_ou
= NULL
, *fp_top1
= NULL
, *fp_top2
= NULL
, *fp_top3
= NULL
;
33 long long int ttnbytes
=0, ttnacc
=0, tnacc
=0;
34 long long int tnbytes
=0, ttnelap
=0, tnelap
=0;
35 long long int tnincache
=0, tnoucache
=0, ttnincache
=0, ttnoucache
=0;
40 long long int elap
, incac
, oucac
;
43 float inperc
=0.00, ouperc
=0.00;
45 char olduser
[MAXLEN
], csort
[MAXLEN
], period
[MAXLEN
], arqper
[MAXLEN
];
46 char wger
[MAXLEN
], top1
[MAXLEN
], top2
[MAXLEN
], top3
[MAXLEN
];
47 char user
[MAXLEN
], preg
[MAXLEN
], tusr
[MAXLEN
];
48 char ip
[MAXLEN
], time
[30], date
[30];
49 char ipantes
[MAXLEN
], nameantes
[MAXLEN
];
50 char sfield
[10]="2,2";
66 struct getwordstruct gwarea
;
76 strcat(wger
,"/sarg-general");
78 strcat(top2
,"/top.tmp");
79 strcat(tusr
,"/sarg-users");
80 strcat(top3
,"/index.html");
83 if((fp_in
=fopen(wger
,"r"))==NULL
) {
84 fprintf(stderr
, "SARG: (topuser) %s: %s\n",text
[45],wger
);
88 if((fp_top2
=fopen(top2
,"w"))==NULL
) {
89 fprintf(stderr
, "SARG: (topuser) %s: %s\n",text
[45],top2
);
96 while(fgets(warea
,sizeof(warea
),fp_in
)) {
97 getword_start(&gwarea
,warea
);
98 if (getword(user
,sizeof(user
),&gwarea
,'\t')<0) {
99 printf("SARG: Maybe you have a broken user in your %s file.\n",wger
);
102 if(strcmp(user
,"TOTAL") == 0) {
105 if (getword_atoll(&nacc
,&gwarea
,'\t')<0) {
106 printf("SARG: Maybe you have a broken number of access in your %s file.\n",wger
);
109 if (getword_atoll(&nbytes
,&gwarea
,'\t')<0) {
110 printf("SARG: Maybe you have a broken number of bytes in your %s file.\n",wger
);
113 if (getword(url
,sizeof(url
),&gwarea
,'\t')<0) {
114 printf("SARG: Maybe you have a broken url in your %s file.\n",wger
);
117 if (getword(ip
,sizeof(ip
),&gwarea
,'\t')<0) {
118 printf("SARG: Maybe you have a broken user's IP in your %s file.\n",wger
);
121 if (getword(time
,sizeof(time
),&gwarea
,'\t')<0) {
122 printf("SARG: Maybe you have a broken time in your %s file.\n",wger
);
125 if (getword(date
,sizeof(date
),&gwarea
,'\t')<0) {
126 printf("SARG: Maybe you have a broken date in your %s file.\n",wger
);
129 if (getword_atoll(&elap
,&gwarea
,'\t')<0) {
130 printf("SARG: Maybe you have a broken download duration in your %s file.\n",wger
);
133 if (getword_atoll(&incac
,&gwarea
,'\t')<0) {
134 printf("SARG: Maybe you have a broken in cache download in your %s file.\n",wger
);
137 if (getword_atoll(&oucac
,&gwarea
,'\n')<0) {
138 printf("SARG: Maybe you have a broken not in cache download in your %s file.\n",wger
);
141 if(strcmp(olduser
,user
) != 0) {
144 if (olduser
[0] != '\0') {
145 my_lltoa(tnbytes
,val1
,15);
146 my_lltoa(tnacc
,val2
,15);
147 my_lltoa(tnelap
,val3
,15);
148 my_lltoa(tnincache
,val4
,15);
149 my_lltoa(tnoucache
,val5
,15);
150 fprintf(fp_top2
,"%s\t%s\t%s\t%s\t%s\t%s\n",olduser
,val1
,val2
,val3
,val4
,val5
);
155 ttnincache
+=tnincache
;
156 ttnoucache
+=tnoucache
;
158 strcpy(olduser
,user
);
173 if (olduser
[0] != '\0') {
174 my_lltoa(tnbytes
,val1
,15);
175 my_lltoa(tnacc
,val2
,15);
176 my_lltoa(tnelap
,val3
,15);
177 my_lltoa(tnincache
,val4
,15);
178 my_lltoa(tnoucache
,val5
,15);
179 fprintf(fp_top2
,"%s\t%s\t%s\t%s\t%s\t%s\n",olduser
,val1
,val2
,val3
,val4
,val5
);
184 ttnincache
+=tnincache
;
185 ttnoucache
+=tnoucache
;
189 my_lltoa(ttnbytes
,val1
,15);
190 my_lltoa(ttnacc
,val2
,15);
191 my_lltoa(ttnelap
,val3
,15);
192 my_lltoa(ttnincache
,val4
,15);
193 my_lltoa(ttnoucache
,val5
,15);
194 if (fp_in
) fclose(fp_in
);
195 if (fp_top2
) fclose(fp_top2
);
197 strup(TopuserSortField
);
198 strlow(TopuserSortOrder
);
200 if(strcmp(TopuserSortField
,"USER") == 0)
201 strcpy(sfield
,"1,1");
203 if(strcmp(TopuserSortField
,"CONNECT") == 0)
204 strcpy(sfield
,"3,3");
206 if(strcmp(TopuserSortField
,"TIME") == 0)
207 strcpy(sfield
,"4,4");
209 if(strcmp(TopuserSortOrder
,"normal") == 0)
212 sprintf(csort
,"sort -n -T \"%s\" %s -k %s -o \"%s\" \"%s\"", TempDir
, order
, sfield
, top1
, top2
);
213 cstatus
=system(csort
);
214 if (!WIFEXITED(cstatus
) || WEXITSTATUS(cstatus
)) {
215 fprintf(stderr
, "SARG: sort command return status %d\n",WEXITSTATUS(cstatus
));
216 fprintf(stderr
, "SARG: sort command: %s\n",csort
);
219 if((fp_top1
=fopen(top1
,"a"))==NULL
) {
220 fprintf(stderr
, "SARG: (topuser) %s: %s\n",text
[45],top1
);
221 fprintf(stderr
, "SARG: sort command: %s\n",csort
);
227 fprintf(fp_top1
,"TOTAL\t%s\t%s\t%s\t%s\t%s\n",val1
,val2
,val3
,val4
,val5
);
234 strcpy(arqper
,dirname
);
235 strcat(arqper
,"/sarg-period");
237 if ((fp_in
= fopen(arqper
, "r")) == 0) {
238 fprintf(stderr
, "SARG: (topuser) %s: %s\n",text
[45],arqper
);
242 if (!fgets(period
,sizeof(period
),fp_in
)) {
243 fprintf(stderr
,"SARG: (topuser) Read error in %s\n",arqper
);
248 if((fp_top1
=fopen(top1
,"r"))==NULL
) {
249 fprintf(stderr
, "SARG: (topuser) %s: %s\n",text
[45],top1
);
253 if((fp_top3
=fopen(top3
,"w"))==NULL
) {
254 fprintf(stderr
, "SARG: (topuser) %s: %s\n",text
[45],top3
);
258 fprintf(fp_top3
, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet
);
260 fprintf(fp_top3
,"</head>\n<body class=\"body\">");
261 write_logo_image(fp_top3
);
263 if(IndexTree
== INDEX_TREE_DATE
)
264 show_sarg(fp_top3
, "../../..");
266 show_sarg(fp_top3
, "..");
267 fputs("<div align=\"center\"><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_top3
);
268 fprintf(fp_top3
,"<tr><th align=\"center\" class=\"title\">%s</th></tr>\n",Title
);
270 fprintf(fp_top3
,"<tr><td class=\"header3\">%s: %s</td></tr>\n",text
[89],period
);
271 strcat(wheader
,(char *)text
[104]);
272 strcat(wheader
,": ");
273 strcat(wheader
,TopuserSortField
);
274 strcat(wheader
,", ");
275 strcat(wheader
,TopuserSortOrder
);
276 fprintf(fp_top3
,"<tr><td class=\"header3\">%s</td></tr>\n",wheader
);
277 fprintf(fp_top3
,"<tr><th class=\"header3\">%s</th></tr>\n",text
[137]);
279 fputs("</table></div>\n",fp_top3
);
280 fputs("<div align=\"center\"><table cellpadding=\"1\" cellspacing=\"2\">\n",fp_top3
);
281 fputs("<tr><td><br></td><td></td></tr>\n",fp_top3
);
283 if((ReportType
& REPORT_TYPE_TOPSITES
) != 0 && !Privacy
) fprintf(fp_top3
,"<tr><td class=\"link\" colspan=\"11\"><a href=\"topsites.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text
[119]);
284 if((ReportType
& REPORT_TYPE_SITES_USERS
) != 0 && !Privacy
) fprintf(fp_top3
,"<tr><td class=\"link\" colspan=\"11\"><a href=\"siteuser.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text
[85]);
285 if(dansguardian_count
) fprintf(fp_top3
,"<tr><td class=\"link\" colspan=\"11\"><a href=\"dansguardian.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text
[128]);
286 if(squidguard_count
) fprintf(fp_top3
,"<tr><td class=\"link\" colspan=11><a href=\"squidguard.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text
[122]);
287 if ((ReportType
& REPORT_TYPE_DOWNLOADS
) != 0 && download_count
&& !Privacy
&& ndownload
) fprintf(fp_top3
,"<tr><td class=\"link\" colspan=\"11\"><a href=\"download.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text
[125]);
288 if ((ReportType
& REPORT_TYPE_DENIED
) != 0 && denied_count
&& !Privacy
) fprintf(fp_top3
,"<tr><td class=\"link\" colspan=\"11\"><a href=\"denied.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text
[118]);
289 if ((ReportType
& REPORT_TYPE_AUTH_FAILURES
) != 0 && authfail_count
&& !Privacy
) fprintf(fp_top3
,"<tr><td class=\"link\" colspan=\"11\"><a href=\"authfail.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text
[117]);
290 if(smartfilter
) fprintf(fp_top3
,"<tr><td class=\"link\" colspan=\"11\"><a href=\"smartfilter.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text
[116]);
291 fputs("<tr><td></td></tr>\n",fp_top3
);
293 if ((ReportType
& REPORT_TYPE_TOPUSERS
) == 0) {
294 fputs("</body>\n</html>\n",fp_top3
);
295 if (fp_top3
) fclose (fp_top3
);
299 strcpy(hbc10
,"class=\"header\"");
301 if((TopUserFields
& TOPUSERFIELDS_NUM
) == 0) {
305 strcpy(val1
,text
[100]);
306 strcpy(hbc1
,"class=\"header\"");
308 if((TopUserFields
& TOPUSERFIELDS_USERID
) == 0) {
312 strcpy(val2
,text
[98]);
313 strcpy(hbc2
,"class=\"header\"");
315 if((TopUserFields
& TOPUSERFIELDS_CONNECT
) == 0) {
319 strcpy(val3
,text
[92]);
320 strcpy(hbc3
,"class=\"header\"");
322 if((TopUserFields
& TOPUSERFIELDS_BYTES
) == 0) {
326 strcpy(val4
,text
[93]);
327 strcpy(hbc4
,"class=\"header\"");
329 if((TopUserFields
& TOPUSERFIELDS_SETYB
) == 0) {
333 sprintf(val11
,"%%%s",text
[93]);
334 strcpy(hbc9
,"class=\"header\"");
336 if((TopUserFields
& TOPUSERFIELDS_IN_CACHE_OUT
) == 0) {
340 strcpy(val10
,"<td></td>");
342 sprintf(val5
,"%s-%s-%s",text
[113],text
[114],text
[112]);
343 strcpy(hbc5
,"class=\"header3\"");
344 strcpy(val9
,"colspan=\"2\"");
347 if((TopUserFields
& TOPUSERFIELDS_USED_TIME
) == 0) {
351 strcpy(val6
,text
[94]);
352 strcpy(hbc6
,"class=\"header\"");
354 if((TopUserFields
& TOPUSERFIELDS_MILISEC
) == 0) {
358 strcpy(val7
,text
[95]);
359 strcpy(hbc7
,"class=\"header\"");
361 if((TopUserFields
& TOPUSERFIELDS_PTIME
) == 0) {
365 sprintf(val8
,"%%%s",text
[99]);
366 strcpy(hbc8
,"class=\"header\"");
369 fprintf(fp_top3
,"<tr><th %s>%s</th><th %s></th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s %s>%s%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th></tr>\n",hbc1
,val1
,hbc1
,hbc2
,val2
,hbc3
,val3
,hbc4
,val4
,hbc9
,val11
,hbc5
,val9
,val5
,val10
,hbc6
,val6
,hbc7
,val7
,hbc8
,val8
);
373 while(fgets(warea
,sizeof(warea
),fp_top1
)) {
374 getword_start(&gwarea
,warea
);
375 if (getword(user
,sizeof(user
),&gwarea
,'\t')<0) {
376 printf("SARG: Maybe you have a broken user in your %s file.\n",top1
);
379 if (getword_atoll(&nbytes
,&gwarea
,'\t')<0) {
380 printf("SARG: Maybe you have a broken number of bytes in your %s file.\n",top1
);
383 if (getword_atoll(&nacc
,&gwarea
,'\t')<0) {
384 printf("SARG: Maybe you have a broken number of access in your %s file.\n",top1
);
387 if (getword_atoll(&elap
,&gwarea
,'\t')<0) {
388 printf("SARG: Maybe you have a broken elpased time in your %s file.\n",wger
);
391 if (getword_atoll(&incac
,&gwarea
,'\t')<0) {
392 printf("SARG: Maybe you have a broken in-cache size in your %s file.\n",wger
);
395 if (getword_atoll(&oucac
,&gwarea
,'\n')<0) {
396 printf("SARG: Maybe you have a broken out-of-cache size in your %s file.\n",wger
);
403 if(TopUsersNum
> 0 && topcount
>= TopUsersNum
) goto final
;
409 perc
=perc
/ ttnbytes
;
414 perc2
=((perc2
* 100) / ttnelap
);
419 inperc
=((inperc
* 100) / tnbytes
);
424 ouperc
=((ouperc
* 100) / tnbytes
);
427 if(strcmp(user
,"TOTAL") != 0){
428 sprintf(href1
,"<a href=\"%s/%s.html\">",user
,user
);
429 strcpy(href1end
,"</a>");
430 sprintf(href2
,"<a href=\"%s/d%s.html\">",user
,user
);
431 strcpy(href2end
,"</a>");
432 sprintf(href3
,"<a href=\"%s/graph_day.png\">",user
);
433 strcpy(href3end
,"</a>");
454 if(strcmp(user2
,ipantes
) != 0) {
455 strcpy(ipantes
,user2
);
456 ip2name(user2
,sizeof(user2
));
457 strcpy(nameantes
,user2
);
458 } else strcpy(user2
,nameantes
);
462 if((ReportType
& REPORT_TYPE_DATE_TIME
) != 0) {
463 sprintf(ltext110
,"%s",text
[110]);
464 for(s
=ltext110
; *s
; ++s
)
467 bzero(href2
, MAXLEN
);
470 sprintf(val1
,"%s/d%s.html",dirname
,user
);
474 if(strcmp(user2
,"TOTAL") != 0) {
475 user_find(name
, sizeof(name
), user2
);
478 ((str
=(char *) strstr(name
, ".")) != (char *) NULL
) &&
479 ((str
=(char *) strstr(str
+1, ".")) != (char *) NULL
))
480 ip2name(name
,sizeof(name
));
485 strcpy(wwork1
,fixnum(nacc
,1));
486 strcpy(wwork2
,fixnum(tnbytes
,1));
487 strcpy(wwork3
,fixnum2(tnelap
,1));
489 sprintf(val1
,"%d",posicao
);
491 sprintf(val2
,"%s<img src=\"%s/graph.png\" border=\"0\" title=\"%s\" alt=\"G\">%s %s<img src=\"%s/datetime.png\" border=\"0\" title=\"%s %s\" alt=\"T\">%s\n",href3
,ImageFile
,text
[126],href3end
,href2
,ImageFile
,ltext110
,text
[55],href2end
);
493 sprintf(val2
,"%s<img src=\"%s/datetime.png\" border=\"0\" title=\"%s\" alt=\"T\">%s\n",href2
,ImageFile
,ltext110
,href2end
);
496 sprintf(val3
,"%3.2f%%",perc
);
497 sprintf(val4
,"%3.2f%%",inperc
);
498 sprintf(val5
,"%3.2f%%",ouperc
);
499 sprintf(val6
,"%s",buildtime(tnelap
));
500 sprintf(val7
,"%3.2f%%",perc2
);
502 strcpy(hbc1
,"class=\"data\"");
503 strcpy(hbc2
,"class=\"data2\"");
504 strcpy(hbc3
,"class=\"data\"");
505 strcpy(hbc4
,"class=\"data\"");
506 strcpy(hbc5
,"class=\"data\"");
507 strcpy(hbc6
,"class=\"data\"");
508 strcpy(hbc7
,"class=\"data\"");
509 strcpy(hbc8
,"class=\"data\"");
510 strcpy(hbc9
,"class=\"data\"");
511 strcpy(hbc10
,"class=\"data\"");
513 if((TopUserFields
& TOPUSERFIELDS_NUM
) == 0) {
517 if((TopUserFields
& TOPUSERFIELDS_USERID
) == 0) {
521 if((TopUserFields
& TOPUSERFIELDS_CONNECT
) == 0) {
525 if((TopUserFields
& TOPUSERFIELDS_BYTES
) == 0) {
529 if((TopUserFields
& TOPUSERFIELDS_SETYB
) == 0) {
534 if((TopUserFields
& TOPUSERFIELDS_IN_CACHE_OUT
) == 0) {
538 if((TopUserFields
& TOPUSERFIELDS_IN_CACHE_OUT
) == 0) {
542 if((TopUserFields
& TOPUSERFIELDS_USED_TIME
) == 0) {
546 if((TopUserFields
& TOPUSERFIELDS_MILISEC
) == 0) {
550 if((TopUserFields
& TOPUSERFIELDS_PTIME
) == 0) {
555 if((ReportType
& REPORT_TYPE_USERS_SITES
) == 0) {
560 if(dotinuser
&& strchr(name
,'_')) {
561 subs(name
,sizeof(name
),"_",".");
564 sprintf(preg
,"<tr><td %s>%s</td><td %s>%s</td><td %s>%s%s%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s<td %s>%s</td></tr>\n",hbc1
,val1
,hbc2
,val2
,hbc2
,href1
,name
,href1end
,hbc3
,wwork1
,hbc4
,wwork2
,hbc5
,val3
,hbc6
,val4
,hbc7
,val5
,hbc8
,val6
,hbc9
,wwork3
,hbc10
,val7
);
566 if(strstr(user
,"TOTAL") != 0) {
569 inperc
=ttnbytes
/ 100;
570 inperc
=incac
/ inperc
;
574 ouperc
=ttnbytes
/ 100;
575 ouperc
=oucac
/ ouperc
;
578 sprintf(wwork1
,"%s",fixnum(ttnacc
,1));
579 sprintf(wwork2
,"%s",fixnum(ttnbytes
,1));
580 sprintf(wwork3
,"%s",fixnum2(ttnelap
,1));
582 strcpy(hbc1
,"class=\"header2\"");
583 strcpy(hbc2
,"class=\"header2\"");
584 strcpy(hbc3
,"class=\"header2\"");
585 strcpy(hbc4
,"class=\"header2\"");
586 strcpy(hbc5
,"class=\"header2\"");
587 strcpy(hbc6
,"class=\"header2\"");
588 strcpy(hbc7
,"class=\"header2\"");
589 strcpy(hbc8
,"class=\"header2\"");
590 strcpy(hbc9
,"class=\"header2\"");
591 strcpy(hbc10
,"class=\"header\"");
593 sprintf(val4
,"%3.2f%%",inperc
);
594 sprintf(val5
,"%3.2f%%",ouperc
);
595 sprintf(val6
,"%s",buildtime(ttnelap
));
596 sprintf(val7
,"%3.2f%%",perc2
);
598 if((TopUserFields
& TOPUSERFIELDS_CONNECT
) == 0) {
602 if((TopUserFields
& TOPUSERFIELDS_BYTES
) == 0) {
606 if((TopUserFields
& TOPUSERFIELDS_IN_CACHE_OUT
) == 0) {
612 if((TopUserFields
& TOPUSERFIELDS_USED_TIME
) == 0) {
616 if((TopUserFields
& TOPUSERFIELDS_MILISEC
) == 0) {
621 if((ReportType
& REPORT_TYPE_DATE_TIME
) != 0) {
622 if((TopUserFields
& TOPUSERFIELDS_TOTAL
) != 0)
623 sprintf(preg
,"<tr><td></td><td></td><th %s>%s</th><th %s>%s</th><th %s>%15s</th><td></td><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th></tr>\n",hbc10
,text
[107],hbc1
,wwork1
,hbc2
,wwork2
,hbc3
,val4
,hbc4
,val5
,hbc5
,val6
,hbc6
,wwork3
);
624 } else if((TopUserFields
& TOPUSERFIELDS_TOTAL
) != 0)
625 sprintf(preg
,"<tr><td></td><td></td><th %s>%s</th><th %s>%s</th><th %s>%15s</th><td></td><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th></tr>\n",hbc10
,text
[107],hbc1
,wwork1
,hbc2
,wwork2
,hbc3
,val4
,hbc4
,val5
,hbc5
,val6
,hbc6
,wwork3
);
633 if(ttnbytes
) tnbytes
=ttnbytes
/ totuser
;
636 twork
=ttnacc
/totuser
;
637 twork2
=ttnelap
/totuser
;
638 strcpy(wwork1
,fixnum(twork
,1));
639 strcpy(wwork2
,fixnum(tnbytes
,1));
640 strcpy(wwork3
,fixnum2(twork2
,1));
642 if((TopUserFields
& TOPUSERFIELDS_CONNECT
) == 0) {
646 if((TopUserFields
& TOPUSERFIELDS_BYTES
) == 0) {
650 if((TopUserFields
& TOPUSERFIELDS_IN_CACHE_OUT
) == 0) {
656 if((TopUserFields
& TOPUSERFIELDS_USED_TIME
) == 0) {
660 if((TopUserFields
& TOPUSERFIELDS_MILISEC
) == 0) {
666 if(((ReportType
& REPORT_TYPE_DATE_TIME
) != 0 && (TopUserFields
& TOPUSERFIELDS_AVERAGE
) != 0))
667 fprintf(fp_top3
,"<tr><td></td><th></th><th %s>%s</th><th %s>%s</th><th %s>%15s</th><td></td><td></td><td></td><th %s>%s</th><th %s>%s</th></tr>\n",hbc10
,text
[96],hbc1
,wwork1
,hbc2
,wwork2
,hbc3
,buildtime(ttnelap
/totuser
),hbc4
,wwork3
);
668 else if((TopUserFields
& TOPUSERFIELDS_AVERAGE
) != 0)
669 fprintf(fp_top3
,"<tr><td></td><th></th><td></td><th %s>%s</th><th %s>%s</th><th %s>%15s</th><td></td><td></td><td></td><th %s>%s</th><th %s>%s</th></tr>\n",hbc10
,text
[96],hbc1
,wwork1
,hbc2
,wwork2
,hbc3
,buildtime(ttnelap
/totuser
),hbc4
,wwork3
);
672 if(UserAgentLog
[0] != '\0') {
673 fputs("<tr><td></td></tr>\n",fp_top3
);
674 fputs("<tr><td></td></tr>\n",fp_top3
);
675 fputs("<td align=\"left\" colspan=\"8\"><font size=-1><a href=\"useragent.html\">Useragent</a> Report</td>\n",fp_top3
);
678 fputs("</table></div>",fp_top3
);
686 if((fp_ou
=fopen(tusr
,"w"))==NULL
) {
687 fprintf(stderr
, "SARG: (topuser) %s: %s\n",text
[45],tusr
);
691 fprintf(fp_ou
,"%d\n",totuser
);
693 fputs("</body>\n</html>\n",fp_top3
);