]>
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
&& strstr(name2
,"_")) {
165 str2
=(char *)subs(name2
,"_",".");
169 if ((fp_in
= fopen(arqin
, "r")) == 0){
170 fprintf(stderr
, "SARG: (html3) %s: %s\n",text
[45],arqin
);
174 while(fgets(buf
,sizeof(buf
),fp_in
)!=NULL
) {
175 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
176 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqin
);
179 tnacc
+=my_atoll(wtemp
);
180 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
181 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqin
);
184 tnbytes
+=my_atoll(wtemp
);
185 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 || getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 ||
186 getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
187 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqin
);
190 tnelap
+=my_atoll(wtemp
);
191 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
192 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqin
);
195 tnincache
+=my_atoll(wtemp
);
196 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
197 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqin
);
200 tnoucache
+=my_atoll(wtemp
);
205 if ((fp_in
= fopen(arqin
, "r")) == 0){
206 fprintf(stderr
, "SARG: (html4) %s: %s\n",text
[45],arqin
);
210 if ((fp_ou
= fopen(arqou
, "w")) == 0){
211 fprintf(stderr
, "SARG: (html5) %s: %s\n",text
[45],arqou
);
215 fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_ou
);
216 fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_ou
);
217 fputs("<html>\n",fp_ou
);
218 fputs("<head>\n",fp_ou
);
219 fprintf(fp_ou
," <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet
);
221 fputs("</head>\n",fp_ou
);
223 fprintf(fp_ou
,"<body style=\"font-family:%s;font-size:%s;background-color:%s; \
224 background-image:url(%s)\">\n",FontFace
,TitleFontSize
,BgColor
,BgImage
);
226 if(strlen(LogoImage
) > 0) {
227 fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ou
);
228 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
);
229 fputs("<tr><td height=\"5\"></td></tr>\n",fp_ou
);
230 fputs("</table>\n",fp_ou
);
233 if(strcmp(IndexTree
,"date") == 0)
234 show_sarg(fp_ou
, "../../../..");
236 show_sarg(fp_ou
, "../..");
238 fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ou
);
239 fprintf(fp_ou
,"<tr><th class=\"title\" colspan=\"2\">%s</th></tr>\n",Title
);
241 fprintf(fp_ou
,"<tr><td class=\"header\" colspan=\"2\">%s: %s</td></tr>\n",text
[89],period
);
242 fprintf(fp_ou
,"<tr><td class=\"header\" colspan=\"2\">%s: %s</td></tr>\n",text
[90],name2
);
243 fprintf(fp_ou
,"<tr><td class=\"header\" colspan=\"2\">%s: %s, %s</td></tr>\n",text
[104],UserSortField
,UserSortOrder
);
244 fprintf(fp_ou
,"<tr><td class=\"header3\" colspan=2>%s %s</td></tr>\n",text
[32],text
[55]);
245 fputs("<tr><td></td></tr>\n",fp_ou
);
247 fputs("</table></center>\n",fp_ou
);
248 fputs("<center><table cellpadding=\"2\" cellspacing=\"1\">\n",fp_ou
);
250 if(strlen(denied_report
) > 0) {
251 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]);
254 strcpy(val3
,text
[92]);
255 strcpy(val4
,text
[93]);
256 sprintf(val11
,"%%%s",text
[93]);
257 sprintf(val5
,"%s-%s-%s",text
[113],text
[114],text
[112]);
258 strcpy(val6
,text
[94]);
259 strcpy(val7
,text
[95]);
260 sprintf(val8
,"%%%s",text
[99]);
261 strcpy(val9
,"colspan=2");
264 if(strstr(UserReportFields
,"CONNECT") == 0)
266 if(strstr(UserReportFields
,"BYTES") == 0)
268 if(strstr(UserReportFields
,"SETYB") == 0)
270 if(strstr(UserReportFields
,"IN-CACHE-OUT") == 0) {
273 strcpy(val10
,"<td></td>");
275 if(strstr(UserReportFields
,"USED_TIME") == 0)
277 if(strstr(UserReportFields
,"MILISEC") == 0)
279 if(strstr(UserReportFields
,"%TIME") == 0)
282 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
);
288 sprintf(msg
, "%s: %s",text
[61],u2
);
290 sprintf(msg
, "%s: %s",text
[61],usuario
);
294 fscanf(fp_in
,"%s",nacc
);
295 fscanf(fp_in
,"%s",nbytes
);
296 fscanf(fp_in
,"%s",url
);
297 fscanf(fp_in
,"%s",tmsg
);
298 fscanf(fp_in
,"%s",nelap
);
299 fscanf(fp_in
,"%s",incac
);
300 fscanf(fp_in
,"%s",oucac
);
302 while(!feof(fp_in
)) {
303 if(strncmp(tmsg
,"OK",2) != 0)
304 sprintf(tmsg
,"<td class=\"data\">%s</td>",text
[46]);
305 else bzero(tmsg
, 50);
307 nnbytes
=my_atoll(nbytes
);
308 nnelap
=my_atoll(nelap
);
309 incache
=my_atoll(incac
);
310 oucache
=my_atoll(oucac
);
322 perc2
=perc2
/ tnelap
;
326 inperc
=incache
* 100;
327 inperc
=inperc
/ nnbytes
;
331 ouperc
=oucache
* 100;
332 ouperc
=ouperc
/ nnbytes
;
335 twork
=my_atoll(nacc
);
336 strcpy(wwork1
,fixnum(twork
,1));
337 strcpy(wwork2
,fixnum(nnbytes
,1));
338 strcpy(wwork3
,fixnum2(nnelap
,1));
340 if(strcmp(LongUrl
,"yes") != 0) {
341 if (getword(warea
,sizeof(warea
),url
,'/')<0) {
342 printf("SARG: Maybe you have a broken record or garbage in the url of the %s file.\n",arqin
);
345 sprintf(url
,"%s",warea
);
349 url_module(url
, module
);
350 if (getword(warea
,sizeof(warea
),url
,'/')<0) {
351 printf("SARG: Maybe you have a broken record or garbage in the url of the %s file.\n",arqin
);
354 sprintf(url
,"%s...%s",warea
,module
);
357 if(strcmp(Privacy
,"yes") == 0)
358 sprintf(httplink
,"<font color=%s><href=http://%s>%s", \
359 PrivacyStringColor
,PrivacyString
,PrivacyString
);
361 strcpy(tmp6
,"../../images");
362 if(strcmp(IndexTree
,"date") == 0)
363 sprintf(tmp6
,"../%s",ImageFile
);
364 if(strlen(BlockIt
) > 0)
365 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
);
367 sprintf(httplink
,"<a href=http://%s title=\"%s\">%s</a>",urly
,urly
,url
);
369 if(strstr(ReportType
,"site_user_time_date") != 0) {
370 strcpy(ltext110
,text
[110]);
371 for(s
=ltext110
; *s
; ++s
)
373 strcpy(siteind
,urly
);
375 for(z1
=0; str
[z1
]; z1
++) {
376 if(str
[z1
]=='?' || str
[z1
]=='-' || str
[z1
]=='.' || str
[z1
]==':' || str
[z1
]=='/' || str
[z1
]=='\\' || str
[z1
]=='*' ||
377 str
[z1
]=='\'' || str
[z1
]=='\"' || str
[z1
]=='$')
380 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]);
382 bzero(href2
, MAXLEN
);
386 sprintf(val2
,"%s",href2
);
387 sprintf(val3
,"%3.2f%%",perc
);
388 sprintf(val4
,"%3.2f%%",inperc
);
389 sprintf(val5
,"%3.2f%%",ouperc
);
390 sprintf(val6
,"%s",buildtime(nnelap
));
391 sprintf(val7
,"%3.2f%%",perc2
);
393 if(strstr(UserReportFields
,"CONNECT") == 0) {
397 if(strstr(UserReportFields
,"BYTES") == 0) {
401 if(strstr(UserReportFields
,"MILISEC") == 0) {
405 if(strstr(UserReportFields
,"SETYB") == 0) {
409 if(strstr(UserReportFields
,"IN-CACHE-OUT") == 0) {
415 if(strstr(UserReportFields
,"USED_TIME") == 0) {
419 if(strstr(UserReportFields
,"%TIME") == 0) {
423 if(strncmp(tmsg
," ",1) == 0)
427 if(UserReportLimit
<=0 || count
<=UserReportLimit
) {
428 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
);
435 strcat(arqip
,usuario
);
438 if ((fp_ip
= fopen(arqip
, "r")) == 0){
439 fprintf(stderr
, "SARG: (html6) %s: %s\n",text
[45],arqip
);
443 if ((fp_ip2
= MY_FOPEN(tmp2
, "a")) == 0){
444 fprintf(stderr
, "SARG: (html7) %s: %s\n",text
[45],tmp2
);
448 while(fgets(buf
,sizeof(buf
),fp_ip
)!=NULL
) {
449 if(strstr(buf
,url
) != 0)
456 sprintf(csort
,"sort -n -T %s -k 1,1 -k 5,5 -o '%s' '%s'",TempDir
,tmp3
,tmp2
);
457 cstatus
=system(csort
);
458 if (!WIFEXITED(cstatus
) || WEXITSTATUS(cstatus
)) {
459 fprintf(stderr
, "SARG: sort command return status %d\n",WEXITSTATUS(cstatus
));
460 fprintf(stderr
, "SARG: sort command: %s\n",csort
);
464 if ((fp_ip
= MY_FOPEN(tmp3
, "r")) == 0) {
465 fprintf(stderr
, "SARG: (html8) %s: %s\n",text
[45],tmp3
);
469 fscanf(fp_ip
,"%s",user_ip
);
470 fscanf(fp_ip
,"%s",userurl
);
471 fscanf(fp_ip
,"%s",userdia
);
472 fscanf(fp_ip
,"%s",userhora
);
473 fscanf(fp_ip
,"%s",userbytes
);
474 fscanf(fp_ip
,"%s",userelap
);
476 strcpy(olduserip
,user_ip
);
478 while(!feof(fp_ip
)) {
479 if(strcmp(user_ip
,olduserip
) != 0) {
480 my_lltoa(unelap
,val2
,0);
481 sprintf(wwork1
,"%s",fixnum(unbytes
,1));
482 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
);
484 strcpy(olduserip
,user_ip
);
490 unbytes
=unbytes
+my_atoll(userbytes
);
491 unelap
=unelap
+my_atoll(userelap
);
493 fscanf(fp_ip
,"%s",user_ip
);
494 fscanf(fp_ip
,"%s",userurl
);
495 fscanf(fp_ip
,"%s",userdia
);
496 fscanf(fp_ip
,"%s",userhora
);
497 fscanf(fp_ip
,"%s",userbytes
);
498 fscanf(fp_ip
,"%s",userelap
);
507 my_lltoa(unelap
,val3
,0);
508 sprintf(wwork1
,"%s",fixnum(unbytes
,1));
509 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
);
516 fscanf(fp_in
,"%s",nacc
);
517 fscanf(fp_in
,"%s",nbytes
);
518 fscanf(fp_in
,"%s",url
);
519 fscanf(fp_in
,"%s",tmsg
);
520 fscanf(fp_in
,"%s",nelap
);
521 fscanf(fp_in
,"%s",incac
);
522 fscanf(fp_in
,"%s",oucac
);
523 // fscanf(fp_in,"%s",datestimes);
538 perc2
=tnelap
/ perc2
;
542 ouperc
=tnoucache
* 100;
543 ouperc
=ouperc
/ tnbytes
;
547 inperc
=tnincache
* 100;
548 inperc
=inperc
/ tnbytes
;
551 sprintf(wwork1
,"%s",fixnum(tnacc
,1));
552 sprintf(wwork2
,"%s",fixnum(tnbytes
,1));
553 sprintf(wwork3
,"%s",fixnum2(tnelap
,1));
555 sprintf(val2
,"%s%s",href2
,ltext110
);
556 sprintf(val3
,"%3.2f%%",perc
);
557 sprintf(val4
,"%3.2f%%",inperc
);
558 sprintf(val5
,"%3.2f%%",ouperc
);
559 sprintf(val6
,"%s",buildtime(tnelap
));
560 sprintf(val7
,"%3.2f%%",perc2
);
562 strcpy(hbc1
,"class=\"header2\"");
563 strcpy(hbc2
,"class=\"header2\"");
564 strcpy(hbc3
,"class=\"header2\"");
565 strcpy(hbc4
,"class=\"header2\"");
566 strcpy(hbc5
,"class=\"header2\"");
567 strcpy(hbc6
,"class=\"header2\"");
568 strcpy(hbc7
,"class=\"header2\"");
569 strcpy(hbc8
,"class=\"header2\"");
570 strcpy(hbc9
,"class=\"header\"");
572 if(strstr(UserReportFields
,"CONNECT") == 0) {
576 if(strstr(UserReportFields
,"BYTES") == 0) {
580 if(strstr(UserReportFields
,"MILISEC") == 0) {
584 if(strstr(UserReportFields
,"SETYB") == 0) {
588 if(strstr(UserReportFields
,"IN-CACHE-OUT") == 0) {
592 if(strstr(UserReportFields
,"IN-CACHE-OUT") == 0) {
596 if(strstr(UserReportFields
,"USED_TIME") == 0) {
600 if(strstr(UserReportFields
,"%TIME") == 0) {
605 if(strstr(UserReportFields
,"TOTAL") != 0) {
606 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
);
611 if(atoi(PerUserLimit
) > 0) {
612 if(tnbytes
> (atoi(PerUserLimit
)*1000000)) {
614 if(access(PerUserLimitFile
, R_OK
) == 0) {
615 if((fp_usr
= fopen(PerUserLimitFile
, "r")) == 0) {
616 fprintf(stderr
, "SARG: (html9) %s: %s\n",text
[45],PerUserLimitFile
);
619 while(fgets(tmp6
,sizeof(tmp6
),fp_usr
)!=NULL
) {
620 if(strstr(tmp6
,"\n") != 0)
621 tmp6
[strlen(tmp6
)-1]='\0';
622 if(strcmp(tmp6
,u2
) == 0) {
631 if((fp_usr
= fopen(PerUserLimitFile
, "a")) == 0) {
632 fprintf(stderr
, "SARG: (html10) %s: %s\n",text
[45],PerUserLimitFile
);
635 fprintf(fp_usr
,"%s\n",u2
);
639 sprintf(msg
, "%s %s %s (%s MB). %s %s",text
[32],u2
,text
[74],PerUserLimit
,text
[75],PerUserLimitFile
);
651 if (strstr(ReportType
,"topuser") != 0) {
652 strcpy(arqper
,dirname
);
653 strcat(arqper
,"/sarg-users");
655 if ((fp_in
= fopen(arqper
, "r")) == 0){
656 fprintf(stderr
, "SARG: (html11) %s: %s\n",text
[45],arqper
);
660 fgets(totuser
,8,fp_in
);
663 totbytes2
=totbytes
/my_atoll(totuser
);
664 totelap2
=totelap
/my_atoll(totuser
);
667 perc
= totbytes
/ 100;
668 perc
= totbytes2
/ perc
;
672 perc2
= totelap
/ 100;
673 perc2
= totelap2
/ perc2
;
676 twork2
=my_atoll(totuser
);
679 sprintf(wwork1
,"%s",fixnum(twork
,1));
680 sprintf(wwork2
,"%s",fixnum(totbytes2
,1));
681 sprintf(wwork3
,"%s",fixnum2(totelap2
,1));
683 sprintf(val6
,"%s",buildtime(totelap2
));
684 sprintf(val7
,"%3.2f%%",perc2
);
686 strcpy(hbc1
,"class=\"header2\"");
687 strcpy(hbc2
,"class=\"header2\"");
688 strcpy(hbc3
,"class=\"header2\"");
689 strcpy(hbc4
,"class=\"header2\"");
690 strcpy(hbc5
,"class=\"header2\"");
691 strcpy(hbc6
,"class=\"header\"");
693 if(strstr(UserReportFields
,"CONNECT") == 0) {
697 if(strstr(UserReportFields
,"BYTES") == 0) {
701 if(strstr(UserReportFields
,"MILISEC") == 0) {
705 if(strstr(UserReportFields
,"USED_TIME") == 0) {
709 if(strstr(UserReportFields
,"%TIME") == 0) {
714 if(strstr(UserReportFields
,"AVERAGE") != 0) {
715 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
);
724 fputs("</center></table>\n",fp_ou
);
728 fputs("</body>\n</html>\n",fp_ou
);
736 (void)rewinddir(dirp
);
737 (void)closedir(dirp
);