]>
git.ipfire.org Git - thirdparty/sarg.git/blob - html.c
2 * AUTHOR: Pedro Lineu Orso orso@penguintech.com.br
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
, *fp_ou
, *fp_ip
, *fp_ip2
, *fp_usr
;
34 struct dirent
*direntp
;
35 long long int nnbytes
=0, unbytes
=0, tnbytes
=0, totbytes
=0, totbytes2
=0;
36 long long int totelap
=0, totelap2
=0, nnelap
=0, unelap
=0, tnelap
=0;
37 long long int incache
=0, oucache
=0, tnincache
=0, tnoucache
=0, twork
=0, twork2
=0;
38 char arqin
[MAXLEN
], arqou
[MAXLEN
], arqper
[MAXLEN
], arqip
[MAXLEN
];
39 char nacc
[20], nbytes
[20], url
[1024], tmsg
[50], nelap
[20], csort
[MAXLEN
];
40 char period
[MAXLEN
], usuario
[MAXLEN
], wusuario
[MAXLEN
], u2
[MAXLEN
], duser
[MAXLEN
];
41 char userbytes
[20], userelap
[20], userurl
[1024], userhora
[9], userdia
[9];
42 char user_ip
[MAXLEN
], olduserip
[MAXLEN
], tmp2
[MAXLEN
], tmp3
[MAXLEN
], incac
[20], oucac
[20];
43 char denied_report
[255], name2
[MAXLEN
];
44 //char ttd1[3], ttd2[3], ttd3[5], ttt1[3], ttt2[3], ttt3[3];
47 char wtemp
[MAXLEN
], totuser
[8];
48 long long int tnacc
=0, ttnacc
=0, unacc
=0;
49 float perc
=0, perc2
=0, ouperc
=0, inperc
=0;
53 const char txtext
[]=".txt";
56 if(strstr(ReportType
,"users_sites") == 0) return;
59 strcat(tmp2
,"/sargtmp.unsort");
62 strcat(tmp3
,"/sargtmp.log");
64 strcpy(arqper
,dirname
);
65 strcat(arqper
,"/sarg-period");
67 if ((fp_in
= fopen(arqper
, "r")) == 0){
68 fprintf(stderr
, "SARG: (html1) %s: %s\n",text
[45],arqper
);
72 fgets(period
,sizeof(period
),fp_in
);
75 strcpy(arqper
,dirname
);
76 strcat(arqper
,"/sarg-general");
78 if ((fp_in
= fopen(arqper
, "r")) == 0){
79 fprintf(stderr
, "SARG: (html2) %s: %s\n",text
[45],arqper
);
83 while(fgets(buf
,sizeof(buf
),fp_in
)!=NULL
) {
84 if(strstr(buf
,"TOTAL") == 0) {
85 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
86 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqper
);
89 ttnacc
+=my_atoll(buf
);
90 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 || getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
91 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqper
);
94 totbytes
+=my_atoll(wtemp
);
95 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 || getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 ||
96 getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 || getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 ||
97 getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
98 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqper
);
101 totelap
+=my_atoll(wtemp
);
108 while ( (direntp
= readdir( dirp
)) != NULL
) {
109 dlen
=strlen(direntp
->d_name
)-(sizeof(txtext
)-1);
110 if (dlen
<0) continue;
111 if(strcmp(direntp
->d_name
+dlen
,txtext
) != 0)
116 if (dlen
>=sizeof(wusuario
)) continue;
117 strncpy(wusuario
,direntp
->d_name
,dlen
);
122 str
=strrchr(wusuario
,'.');
124 strcpy(denied_report
,str
+1);
126 strcpy(denied_report
,wusuario
);
128 sprintf(warea
,"%s/%s",dirname
,wusuario
);
131 report_day(wusuario
);
132 greport_day(wusuario
);
134 strcpy(usuario
,wusuario
);
137 strcpy(arqou
,dirname
);
139 strcat(arqou
,usuario
);
141 strcat(arqou
,usuario
);
142 strcat(arqou
,".html");
144 strcat(duser
,"denied_");
145 strcat(arqin
,direntp
->d_name
);
147 if((str
=(char *) strstr(denied_report
, "_")) != (char *) NULL
) {
148 if((str
=(char *) strstr(str
+1, "_")) != (char *) NULL
)
149 fixip(denied_report
);
151 strcat(duser
,denied_report
);
152 strcat(duser
,".html");
153 if(access(duser
, R_OK
) != 0)
154 denied_report
[0]='\0';
159 if(strcmp(Ip2Name
,"yes") == 0)
160 ip2name(u2
,sizeof(u2
));
162 get_usertab_name(u2
,name2
,sizeof(name2
));
164 if(dotinuser
&& strchr(name2
,'_')) {
165 subs(name2
,sizeof(name2
),"_",".");
168 if ((fp_in
= fopen(arqin
, "r")) == 0){
169 fprintf(stderr
, "SARG: (html3) %s: %s\n",text
[45],arqin
);
173 while(fgets(buf
,sizeof(buf
),fp_in
)!=NULL
) {
174 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
175 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqin
);
178 tnacc
+=my_atoll(wtemp
);
179 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
180 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqin
);
183 tnbytes
+=my_atoll(wtemp
);
184 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 || getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 ||
185 getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
186 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqin
);
189 tnelap
+=my_atoll(wtemp
);
190 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
191 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqin
);
194 tnincache
+=my_atoll(wtemp
);
195 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
196 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqin
);
199 tnoucache
+=my_atoll(wtemp
);
204 if ((fp_in
= fopen(arqin
, "r")) == 0){
205 fprintf(stderr
, "SARG: (html4) %s: %s\n",text
[45],arqin
);
209 if ((fp_ou
= fopen(arqou
, "w")) == 0){
210 fprintf(stderr
, "SARG: (html5) %s: %s\n",text
[45],arqou
);
214 fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_ou
);
215 fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_ou
);
216 fputs("<html>\n",fp_ou
);
217 fputs("<head>\n",fp_ou
);
218 fprintf(fp_ou
," <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet
);
220 fputs("</head>\n",fp_ou
);
222 fprintf(fp_ou
,"<body style=\"font-family:%s;font-size:%s;background-color:%s; \
223 background-image:url(%s)\">\n",FontFace
,TitleFontSize
,BgColor
,BgImage
);
225 if(strlen(LogoImage
) > 0) {
226 fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ou
);
227 fprintf(fp_ou
,"<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s> %s</th></tr>\n",LogoImage
,Width
,Height
,LogoText
);
228 fputs("<tr><td height=\"5\"></td></tr>\n",fp_ou
);
229 fputs("</table>\n",fp_ou
);
232 if(strcmp(IndexTree
,"date") == 0)
233 show_sarg(fp_ou
, "../../../..");
235 show_sarg(fp_ou
, "../..");
237 fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ou
);
238 fprintf(fp_ou
,"<tr><th class=\"title\" colspan=\"2\">%s</th></tr>\n",Title
);
240 fprintf(fp_ou
,"<tr><td class=\"header\" colspan=\"2\">%s: %s</td></tr>\n",text
[89],period
);
241 fprintf(fp_ou
,"<tr><td class=\"header\" colspan=\"2\">%s: %s</td></tr>\n",text
[90],name2
);
242 fprintf(fp_ou
,"<tr><td class=\"header\" colspan=\"2\">%s: %s, %s</td></tr>\n",text
[104],UserSortField
,UserSortOrder
);
243 fprintf(fp_ou
,"<tr><td class=\"header3\" colspan=2>%s %s</td></tr>\n",text
[32],text
[55]);
244 fputs("<tr><td></td></tr>\n",fp_ou
);
246 fputs("</table></center>\n",fp_ou
);
247 fputs("<center><table cellpadding=\"2\" cellspacing=\"1\">\n",fp_ou
);
249 if(strlen(denied_report
) > 0) {
250 fprintf(fp_ou
,"<tr><td class=\"header\" colspan=11><a href=\"denied_%s.html\">%s</a> %s</td></tr>\n",denied_report
,text
[116],text
[55]);
253 strcpy(val3
,text
[92]);
254 strcpy(val4
,text
[93]);
255 sprintf(val11
,"%%%s",text
[93]);
256 sprintf(val5
,"%s-%s-%s",text
[113],text
[114],text
[112]);
257 strcpy(val6
,text
[94]);
258 strcpy(val7
,text
[95]);
259 sprintf(val8
,"%%%s",text
[99]);
260 strcpy(val9
,"colspan=2");
263 if(strstr(UserReportFields
,"CONNECT") == 0)
265 if(strstr(UserReportFields
,"BYTES") == 0)
267 if(strstr(UserReportFields
,"SETYB") == 0)
269 if(strstr(UserReportFields
,"IN-CACHE-OUT") == 0) {
272 strcpy(val10
,"<td></td>");
274 if(strstr(UserReportFields
,"USED_TIME") == 0)
276 if(strstr(UserReportFields
,"MILISEC") == 0)
278 if(strstr(UserReportFields
,"%TIME") == 0)
281 fprintf(fp_ou
,"<tr><th></th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header3\" %s>%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th></tr>\n",text
[91],val3
,val4
,val11
,val9
,val5
,val6
,val7
,val8
);
287 debuga("%s: %s",text
[61],u2
);
289 debuga("%s: %s",text
[61],usuario
);
292 fscanf(fp_in
,"%s",nacc
);
293 fscanf(fp_in
,"%s",nbytes
);
294 fscanf(fp_in
,"%s",url
);
295 fscanf(fp_in
,"%s",tmsg
);
296 fscanf(fp_in
,"%s",nelap
);
297 fscanf(fp_in
,"%s",incac
);
298 fscanf(fp_in
,"%s",oucac
);
300 while(!feof(fp_in
)) {
301 if(strncmp(tmsg
,"OK",2) != 0)
302 sprintf(tmsg
,"<td class=\"data\">%s</td>",text
[46]);
303 else bzero(tmsg
, 50);
305 nnbytes
=my_atoll(nbytes
);
306 nnelap
=my_atoll(nelap
);
307 incache
=my_atoll(incac
);
308 oucache
=my_atoll(oucac
);
320 perc2
=perc2
/ tnelap
;
324 inperc
=incache
* 100;
325 inperc
=inperc
/ nnbytes
;
329 ouperc
=oucache
* 100;
330 ouperc
=ouperc
/ nnbytes
;
333 twork
=my_atoll(nacc
);
334 strcpy(wwork1
,fixnum(twork
,1));
335 strcpy(wwork2
,fixnum(nnbytes
,1));
336 strcpy(wwork3
,fixnum2(nnelap
,1));
338 if(strcmp(LongUrl
,"yes") != 0) {
339 if (getword(warea
,sizeof(warea
),url
,'/')<0) {
340 printf("SARG: Maybe you have a broken record or garbage in the url of the %s file.\n",arqin
);
343 sprintf(url
,"%s",warea
);
347 url_module(url
, module
);
348 if (getword(warea
,sizeof(warea
),url
,'/')<0) {
349 printf("SARG: Maybe you have a broken record or garbage in the url of the %s file.\n",arqin
);
352 sprintf(url
,"%s...%s",warea
,module
);
355 if(strcmp(Privacy
,"yes") == 0)
356 sprintf(httplink
,"<font color=%s><href=http://%s>%s", \
357 PrivacyStringColor
,PrivacyString
,PrivacyString
);
359 strcpy(tmp6
,"../../images");
360 if(strcmp(IndexTree
,"date") == 0)
361 sprintf(tmp6
,"../%s",ImageFile
);
362 if(strlen(BlockIt
) > 0)
363 sprintf(httplink
,"<a href=\"%s%s?url=%s\"><img src=\"%s/sarg-squidguard-block.png\" border=\"0\"></a><a href=http://%s> %s</a>",wwwDocumentRoot
,BlockIt
,urly
,tmp6
,urly
,urly
);
365 sprintf(httplink
,"<a href=http://%s title=\"%s\">%s</a>",urly
,urly
,url
);
367 if(strstr(ReportType
,"site_user_time_date") != 0) {
368 strcpy(ltext110
,text
[110]);
369 for(s
=ltext110
; *s
; ++s
)
371 strcpy(siteind
,urly
);
373 for(z1
=0; str
[z1
]; z1
++) {
374 if(str
[z1
]=='?' || str
[z1
]=='-' || str
[z1
]=='.' || str
[z1
]==':' || str
[z1
]=='/' || str
[z1
]=='\\' || str
[z1
]=='*' ||
375 str
[z1
]=='\'' || str
[z1
]=='\"' || str
[z1
]=='$')
378 sprintf(href2
,"<a href=\"tt%s-%s.html\"><img src=\"%s/datetime.png\" border=\"0\" title=\"%s %s\"></a>",usuario
,siteind
,tmp6
,ltext110
,text
[55]);
380 bzero(href2
, MAXLEN
);
384 sprintf(val2
,"%s",href2
);
385 sprintf(val3
,"%3.2f%%",perc
);
386 sprintf(val4
,"%3.2f%%",inperc
);
387 sprintf(val5
,"%3.2f%%",ouperc
);
388 sprintf(val6
,"%s",buildtime(nnelap
));
389 sprintf(val7
,"%3.2f%%",perc2
);
391 if(strstr(UserReportFields
,"CONNECT") == 0) {
395 if(strstr(UserReportFields
,"BYTES") == 0) {
399 if(strstr(UserReportFields
,"MILISEC") == 0) {
403 if(strstr(UserReportFields
,"SETYB") == 0) {
407 if(strstr(UserReportFields
,"IN-CACHE-OUT") == 0) {
413 if(strstr(UserReportFields
,"USED_TIME") == 0) {
417 if(strstr(UserReportFields
,"%TIME") == 0) {
421 if(strncmp(tmsg
," ",1) == 0)
425 if(UserReportLimit
<=0 || count
<=UserReportLimit
) {
426 fprintf(fp_ou
,"<tr><td class=\"data\">%s</td><td class=\"data2\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td>%s</tr>\n",val2
,httplink
,wwork1
,wwork2
,val3
,val4
,val5
,val6
,wwork3
,val7
,tmsg
);
433 strcat(arqip
,usuario
);
436 if ((fp_ip
= fopen(arqip
, "r")) == 0){
437 fprintf(stderr
, "SARG: (html6) %s: %s\n",text
[45],arqip
);
441 if ((fp_ip2
= MY_FOPEN(tmp2
, "a")) == 0){
442 fprintf(stderr
, "SARG: (html7) %s: %s\n",text
[45],tmp2
);
446 while(fgets(buf
,sizeof(buf
),fp_ip
)!=NULL
) {
447 if(strstr(buf
,url
) != 0)
454 sprintf(csort
,"sort -n -T %s -k 1,1 -k 5,5 -o '%s' '%s'",TempDir
,tmp3
,tmp2
);
455 cstatus
=system(csort
);
456 if (!WIFEXITED(cstatus
) || WEXITSTATUS(cstatus
)) {
457 fprintf(stderr
, "SARG: sort command return status %d\n",WEXITSTATUS(cstatus
));
458 fprintf(stderr
, "SARG: sort command: %s\n",csort
);
462 if ((fp_ip
= MY_FOPEN(tmp3
, "r")) == 0) {
463 fprintf(stderr
, "SARG: (html8) %s: %s\n",text
[45],tmp3
);
467 fscanf(fp_ip
,"%s",user_ip
);
468 fscanf(fp_ip
,"%s",userurl
);
469 fscanf(fp_ip
,"%s",userdia
);
470 fscanf(fp_ip
,"%s",userhora
);
471 fscanf(fp_ip
,"%s",userbytes
);
472 fscanf(fp_ip
,"%s",userelap
);
474 strcpy(olduserip
,user_ip
);
476 while(!feof(fp_ip
)) {
477 if(strcmp(user_ip
,olduserip
) != 0) {
478 my_lltoa(unelap
,val2
,0);
479 sprintf(wwork1
,"%s",fixnum(unbytes
,1));
480 fprintf(fp_ou
,"<tr><td></td><td class=\"data\">%s</td><td></td><td class=\"data\">%s</td><td></td><td></td><td></td><td class=\"data\">%s</td><td class=\"data\">%s</td></tr>\n",olduserip
,wwork1
,buildtime(unelap
),val2
);
482 strcpy(olduserip
,user_ip
);
488 unbytes
=unbytes
+my_atoll(userbytes
);
489 unelap
=unelap
+my_atoll(userelap
);
491 fscanf(fp_ip
,"%s",user_ip
);
492 fscanf(fp_ip
,"%s",userurl
);
493 fscanf(fp_ip
,"%s",userdia
);
494 fscanf(fp_ip
,"%s",userhora
);
495 fscanf(fp_ip
,"%s",userbytes
);
496 fscanf(fp_ip
,"%s",userelap
);
505 my_lltoa(unelap
,val3
,0);
506 sprintf(wwork1
,"%s",fixnum(unbytes
,1));
507 fprintf(fp_ou
,"<tr><td></td><td class=\"data\">%s</td><td></td><td class=\"data\">%s</td><td></td><td></td><td></td><td class=\"data\">%s</td><td class=\"data\">%s</font></td></tr>\n",olduserip
,wwork1
,buildtime(unelap
),val3
);
514 fscanf(fp_in
,"%s",nacc
);
515 fscanf(fp_in
,"%s",nbytes
);
516 fscanf(fp_in
,"%s",url
);
517 fscanf(fp_in
,"%s",tmsg
);
518 fscanf(fp_in
,"%s",nelap
);
519 fscanf(fp_in
,"%s",incac
);
520 fscanf(fp_in
,"%s",oucac
);
521 // fscanf(fp_in,"%s",datestimes);
536 perc2
=tnelap
/ perc2
;
540 ouperc
=tnoucache
* 100;
541 ouperc
=ouperc
/ tnbytes
;
545 inperc
=tnincache
* 100;
546 inperc
=inperc
/ tnbytes
;
549 sprintf(wwork1
,"%s",fixnum(tnacc
,1));
550 sprintf(wwork2
,"%s",fixnum(tnbytes
,1));
551 sprintf(wwork3
,"%s",fixnum2(tnelap
,1));
553 sprintf(val2
,"%s%s",href2
,ltext110
);
554 sprintf(val3
,"%3.2f%%",perc
);
555 sprintf(val4
,"%3.2f%%",inperc
);
556 sprintf(val5
,"%3.2f%%",ouperc
);
557 sprintf(val6
,"%s",buildtime(tnelap
));
558 sprintf(val7
,"%3.2f%%",perc2
);
560 strcpy(hbc1
,"class=\"header2\"");
561 strcpy(hbc2
,"class=\"header2\"");
562 strcpy(hbc3
,"class=\"header2\"");
563 strcpy(hbc4
,"class=\"header2\"");
564 strcpy(hbc5
,"class=\"header2\"");
565 strcpy(hbc6
,"class=\"header2\"");
566 strcpy(hbc7
,"class=\"header2\"");
567 strcpy(hbc8
,"class=\"header2\"");
568 strcpy(hbc9
,"class=\"header\"");
570 if(strstr(UserReportFields
,"CONNECT") == 0) {
574 if(strstr(UserReportFields
,"BYTES") == 0) {
578 if(strstr(UserReportFields
,"MILISEC") == 0) {
582 if(strstr(UserReportFields
,"SETYB") == 0) {
586 if(strstr(UserReportFields
,"IN-CACHE-OUT") == 0) {
590 if(strstr(UserReportFields
,"IN-CACHE-OUT") == 0) {
594 if(strstr(UserReportFields
,"USED_TIME") == 0) {
598 if(strstr(UserReportFields
,"%TIME") == 0) {
603 if(strstr(UserReportFields
,"TOTAL") != 0) {
604 fprintf(fp_ou
,"<tr><th></th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</font></th><th %s>%s</font></th></tr>\n",hbc9
,text
[107],hbc1
,wwork1
,hbc2
,wwork2
,hbc4
,val3
,hbc5
,val4
,hbc6
,val5
,hbc7
,val6
,hbc3
,wwork3
,hbc8
,val7
);
609 if(atoi(PerUserLimit
) > 0) {
610 if(tnbytes
> (atoi(PerUserLimit
)*1000000)) {
612 if(access(PerUserLimitFile
, R_OK
) == 0) {
613 if((fp_usr
= fopen(PerUserLimitFile
, "r")) == 0) {
614 fprintf(stderr
, "SARG: (html9) %s: %s\n",text
[45],PerUserLimitFile
);
617 while(fgets(tmp6
,sizeof(tmp6
),fp_usr
)!=NULL
) {
618 if(strstr(tmp6
,"\n") != 0)
619 tmp6
[strlen(tmp6
)-1]='\0';
620 if(strcmp(tmp6
,u2
) == 0) {
629 if((fp_usr
= fopen(PerUserLimitFile
, "a")) == 0) {
630 fprintf(stderr
, "SARG: (html10) %s: %s\n",text
[45],PerUserLimitFile
);
633 fprintf(fp_usr
,"%s\n",u2
);
637 debuga("%s %s %s (%s MB). %s %s",text
[32],u2
,text
[74],PerUserLimit
,text
[75],PerUserLimitFile
);
647 if (strstr(ReportType
,"topuser") != 0) {
648 strcpy(arqper
,dirname
);
649 strcat(arqper
,"/sarg-users");
651 if ((fp_in
= fopen(arqper
, "r")) == 0){
652 fprintf(stderr
, "SARG: (html11) %s: %s\n",text
[45],arqper
);
656 fgets(totuser
,8,fp_in
);
659 totbytes2
=totbytes
/my_atoll(totuser
);
660 totelap2
=totelap
/my_atoll(totuser
);
663 perc
= totbytes
/ 100;
664 perc
= totbytes2
/ perc
;
668 perc2
= totelap
/ 100;
669 perc2
= totelap2
/ perc2
;
672 twork2
=my_atoll(totuser
);
675 strcpy(wwork1
,fixnum(twork
,1));
676 strcpy(wwork2
,fixnum(totbytes2
,1));
677 strcpy(wwork3
,fixnum2(totelap2
,1));
679 sprintf(val6
,"%s",buildtime(totelap2
));
680 sprintf(val7
,"%3.2f%%",perc2
);
682 strcpy(hbc1
,"class=\"header2\"");
683 strcpy(hbc2
,"class=\"header2\"");
684 strcpy(hbc3
,"class=\"header2\"");
685 strcpy(hbc4
,"class=\"header2\"");
686 strcpy(hbc5
,"class=\"header2\"");
687 strcpy(hbc6
,"class=\"header\"");
689 if(strstr(UserReportFields
,"CONNECT") == 0) {
693 if(strstr(UserReportFields
,"BYTES") == 0) {
697 if(strstr(UserReportFields
,"MILISEC") == 0) {
701 if(strstr(UserReportFields
,"USED_TIME") == 0) {
705 if(strstr(UserReportFields
,"%TIME") == 0) {
710 if(strstr(UserReportFields
,"AVERAGE") != 0) {
711 fprintf(fp_ou
,"<tr><th></th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th></th><th></th><th></th><th %s>%s</th><th %s>%s</font></th><th %s>%s</th></tr>\n",hbc6
,text
[96],hbc1
,wwork1
,hbc2
,wwork2
,hbc4
,val6
,hbc3
,wwork3
,hbc5
,val7
);
720 fputs("</center></table>\n",fp_ou
);
724 fputs("</body>\n</html>\n",fp_ou
);
732 (void)rewinddir(dirp
);
733 (void)closedir(dirp
);