]>
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"
31 FILE *fp_in
, *fp_ou
, *fp_ip
, *fp_ip2
, *fp_usr
;
33 struct dirent
*direntp
;
34 long long int nnbytes
=0, unbytes
=0, tnbytes
=0, totbytes
=0, totbytes2
=0;
35 long long int totelap
=0, totelap2
=0, nnelap
=0, unelap
=0, tnelap
=0;
36 long long int incache
=0, oucache
=0, tnincache
=0, tnoucache
=0, twork
=0, twork2
=0;
37 char arqin
[MAXLEN
], arqou
[MAXLEN
], arqper
[MAXLEN
], arqip
[MAXLEN
];
38 char nacc
[20], nbytes
[20], url
[1024], tmsg
[50], nelap
[20], csort
[MAXLEN
];
39 char period
[MAXLEN
], usuario
[MAXLEN
], wusuario
[MAXLEN
], u2
[MAXLEN
], duser
[MAXLEN
];
40 char userbytes
[20], userelap
[20], userurl
[1024], userhora
[9], userdia
[9];
41 char user_ip
[MAXLEN
], olduserip
[MAXLEN
], tmp2
[MAXLEN
], tmp3
[MAXLEN
], incac
[20], oucac
[20];
42 char denied_report
[255], name2
[MAXLEN
];
43 //char ttd1[3], ttd2[3], ttd3[5], ttt1[3], ttt2[3], ttt3[3];
46 char wtemp
[MAXLEN
], totuser
[8];
47 long long int tnacc
=0, ttnacc
=0, unacc
=0;
48 float perc
=0, perc2
=0, ouperc
=0, inperc
=0;
53 if(strstr(ReportType
,"users_sites") == 0) return;
56 strcat(tmp2
,"/sargtmp.unsort");
59 strcat(tmp3
,"/sargtmp.log");
61 strcpy(arqper
,dirname
);
62 strcat(arqper
,"/sarg-period");
64 if ((fp_in
= fopen(arqper
, "r")) == 0){
65 fprintf(stderr
, "SARG: (html1) %s: %s\n",text
[45],arqper
);
69 fgets(period
,sizeof(period
),fp_in
);
72 strcpy(arqper
,dirname
);
73 strcat(arqper
,"/sarg-general");
75 if ((fp_in
= fopen(arqper
, "r")) == 0){
76 fprintf(stderr
, "SARG: (html2) %s: %s\n",text
[45],arqper
);
80 while(fgets(buf
,sizeof(buf
),fp_in
)!=NULL
) {
81 if(strstr(buf
,"TOTAL") == 0) {
82 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
83 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqper
);
86 ttnacc
+=my_atoll(buf
);
87 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 || getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
88 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqper
);
91 totbytes
+=my_atoll(wtemp
);
92 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 || getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 ||
93 getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 || getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 ||
94 getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
95 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqper
);
98 totelap
+=my_atoll(wtemp
);
105 while ( (direntp
= readdir( dirp
)) != NULL
) {
106 if(strstr(direntp
->d_name
,".txt") == 0)
110 strcpy(usuario
,direntp
->d_name
);
114 if (getword(warea
,sizeof(warea
),usuario
,'.')<0) {
115 printf("SARG: Maybe you have a broken record or garbage in your %s directory.\n",tmp
);
118 strcpy(denied_report
,warea
);
119 strcat(wusuario
,warea
);
121 if(strcmp(usuario
,"txt") !=0) {
122 strcat(wusuario
,".");
126 sprintf(warea
,"%s/%s",dirname
,wusuario
);
129 report_day(wusuario
);
130 greport_day(wusuario
);
132 strcpy(usuario
,wusuario
);
135 strcpy(arqou
,dirname
);
137 strcat(arqou
,usuario
);
139 strcat(arqou
,usuario
);
140 strcat(arqou
,".html");
142 strcat(duser
,"denied_");
143 strcat(arqin
,direntp
->d_name
);
145 if((str
=(char *) strstr(denied_report
, "_")) != (char *) NULL
) {
146 if((str
=(char *) strstr(str
+1, "_")) != (char *) NULL
)
147 fixip(denied_report
);
149 strcat(duser
,denied_report
);
150 strcat(duser
,".html");
151 if(access(duser
, R_OK
) != 0)
152 denied_report
[0]='\0';
154 if ((fp_in
= fopen(arqin
, "r")) == 0){
155 fprintf(stderr
, "SARG: (html3) %s: %s\n",text
[45],arqin
);
159 while(fgets(buf
,sizeof(buf
),fp_in
)!=NULL
) {
160 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
161 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqin
);
164 tnacc
+=my_atoll(wtemp
);
165 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
166 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqin
);
169 tnbytes
+=my_atoll(wtemp
);
170 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 || getword(wtemp
,sizeof(wtemp
),buf
,' ')<0 ||
171 getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
172 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqin
);
175 tnelap
+=my_atoll(wtemp
);
176 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
177 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqin
);
180 tnincache
+=my_atoll(wtemp
);
181 if (getword(wtemp
,sizeof(wtemp
),buf
,' ')<0) {
182 printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arqin
);
185 tnoucache
+=my_atoll(wtemp
);
190 if ((fp_in
= fopen(arqin
, "r")) == 0){
191 fprintf(stderr
, "SARG: (html4) %s: %s\n",text
[45],arqin
);
195 if ((fp_ou
= fopen(arqou
, "w")) == 0){
196 fprintf(stderr
, "SARG: (html5) %s: %s\n",text
[45],arqou
);
200 fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_ou
);
201 fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_ou
);
202 fputs("<html>\n",fp_ou
);
203 fputs("<head>\n",fp_ou
);
204 fprintf(fp_ou
," <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet
);
206 fputs("</head>\n",fp_ou
);
208 fprintf(fp_ou
,"<body style=\"font-family:%s;font-size:%s;background-color:%s; \
209 background-image:url(%s)\">\n",FontFace
,TitleFontSize
,BgColor
,BgImage
);
211 if(strlen(LogoImage
) > 0) {
212 fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ou
);
213 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
);
214 fputs("<tr><td height=\"5\"></td></tr>\n",fp_ou
);
215 fputs("</table>\n",fp_ou
);
218 if(strcmp(IndexTree
,"date") == 0)
219 show_sarg(fp_ou
, "../../../..");
221 show_sarg(fp_ou
, "../..");
223 fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ou
);
224 fprintf(fp_ou
,"<tr><th class=\"title\" colspan=\"2\">%s</th></tr>\n",Title
);
231 if(strcmp(Ip2Name
,"yes") == 0)
232 ip2name(u2
,sizeof(u2
));
234 if(UserTabFile
[0] != '\0') {
235 sprintf(warea
,":%s:",u2
);
236 if((str
=(char *) strstr(userfile
,warea
)) != (char *) NULL
) {
238 str2
=(char *) strstr(str
+1,":");
241 while(str2
[z1
] != ':') {
245 } else strcpy(name
,u2
);
246 } else strcpy(name
,u2
);
249 if(dotinuser
&& strstr(name2
,"_")) {
250 str2
=(char *)subs(name2
,"_",".");
254 fprintf(fp_ou
,"<tr><td class=\"header\" colspan=\"2\">%s: %s</td></tr>\n",text
[89],period
);
255 fprintf(fp_ou
,"<tr><td class=\"header\" colspan=\"2\">%s: %s</td></tr>\n",text
[90],name2
);
256 fprintf(fp_ou
,"<tr><td class=\"header\" colspan=\"2\">%s: %s, %s</td></tr>\n",text
[104],UserSortField
,UserSortOrder
);
257 fprintf(fp_ou
,"<tr><td class=\"header3\" colspan=2>%s %s</td></tr>\n",text
[32],text
[55]);
258 fputs("<tr><td></td></tr>\n",fp_ou
);
260 fputs("</table></center>\n",fp_ou
);
261 fputs("<center><table cellpadding=\"2\" cellspacing=\"1\">\n",fp_ou
);
263 if(strlen(denied_report
) > 0) {
264 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]);
267 strcpy(val3
,text
[92]);
268 strcpy(val4
,text
[93]);
269 sprintf(val11
,"%%%s",text
[93]);
270 sprintf(val5
,"%s-%s-%s",text
[113],text
[114],text
[112]);
271 strcpy(val6
,text
[94]);
272 strcpy(val7
,text
[95]);
273 sprintf(val8
,"%%%s",text
[99]);
274 strcpy(val9
,"colspan=2");
277 if(strstr(UserReportFields
,"CONNECT") == 0)
279 if(strstr(UserReportFields
,"BYTES") == 0)
281 if(strstr(UserReportFields
,"SETYB") == 0)
283 if(strstr(UserReportFields
,"IN-CACHE-OUT") == 0) {
286 strcpy(val10
,"<td></td>");
288 if(strstr(UserReportFields
,"USED_TIME") == 0)
290 if(strstr(UserReportFields
,"MILISEC") == 0)
292 if(strstr(UserReportFields
,"%TIME") == 0)
295 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
);
301 sprintf(msg
, "%s: %s",text
[61],u2
);
303 sprintf(msg
, "%s: %s",text
[61],usuario
);
307 fscanf(fp_in
,"%s",nacc
);
308 fscanf(fp_in
,"%s",nbytes
);
309 fscanf(fp_in
,"%s",url
);
310 fscanf(fp_in
,"%s",tmsg
);
311 fscanf(fp_in
,"%s",nelap
);
312 fscanf(fp_in
,"%s",incac
);
313 fscanf(fp_in
,"%s",oucac
);
315 while(!feof(fp_in
)) {
316 if(strncmp(tmsg
,"OK",2) != 0)
317 sprintf(tmsg
,"<td class=\"data\">%s</td>",text
[46]);
318 else bzero(tmsg
, 50);
320 nnbytes
=my_atoll(nbytes
);
321 nnelap
=my_atoll(nelap
);
322 incache
=my_atoll(incac
);
323 oucache
=my_atoll(oucac
);
335 perc2
=perc2
/ tnelap
;
339 inperc
=incache
* 100;
340 inperc
=inperc
/ nnbytes
;
344 ouperc
=oucache
* 100;
345 ouperc
=ouperc
/ nnbytes
;
348 twork
=my_atoll(nacc
);
349 strcpy(wwork1
,fixnum(twork
,1));
350 strcpy(wwork2
,fixnum(nnbytes
,1));
351 strcpy(wwork3
,fixnum2(nnelap
,1));
353 if(strcmp(LongUrl
,"yes") != 0) {
354 if (getword(warea
,sizeof(warea
),url
,'/')<0) {
355 printf("SARG: Maybe you have a broken record or garbage in the url of the %s file.\n",arqin
);
358 sprintf(url
,"%s",warea
);
362 url_module(url
, module
);
363 if (getword(warea
,sizeof(warea
),url
,'/')<0) {
364 printf("SARG: Maybe you have a broken record or garbage in the url of the %s file.\n",arqin
);
367 sprintf(url
,"%s...%s",warea
,module
);
370 if(strcmp(Privacy
,"yes") == 0)
371 sprintf(httplink
,"<font color=%s><href=http://%s>%s", \
372 PrivacyStringColor
,PrivacyString
,PrivacyString
);
374 strcpy(tmp6
,"../../images");
375 if(strcmp(IndexTree
,"date") == 0)
376 sprintf(tmp6
,"../%s",ImageFile
);
377 if(strlen(BlockIt
) > 0)
378 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
);
380 sprintf(httplink
,"<a href=http://%s title=\"%s\">%s</a>",urly
,urly
,url
);
382 if(strstr(ReportType
,"site_user_time_date") != 0) {
383 strcpy(ltext110
,text
[110]);
384 for(s
=ltext110
; *s
; ++s
)
386 strcpy(siteind
,urly
);
388 for(z1
=0; str
[z1
]; z1
++) {
389 if(str
[z1
]=='?' || str
[z1
]=='-' || str
[z1
]=='.' || str
[z1
]==':' || str
[z1
]=='/' || str
[z1
]=='\\' || str
[z1
]=='*' ||
390 str
[z1
]=='\'' || str
[z1
]=='\"' || str
[z1
]=='$')
393 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]);
395 bzero(href2
, MAXLEN
);
399 sprintf(val2
,"%s",href2
);
400 sprintf(val3
,"%3.2f%%",perc
);
401 sprintf(val4
,"%3.2f%%",inperc
);
402 sprintf(val5
,"%3.2f%%",ouperc
);
403 sprintf(val6
,"%s",buildtime(nnelap
));
404 sprintf(val7
,"%3.2f%%",perc2
);
406 if(strstr(UserReportFields
,"CONNECT") == 0) {
410 if(strstr(UserReportFields
,"BYTES") == 0) {
414 if(strstr(UserReportFields
,"MILISEC") == 0) {
418 if(strstr(UserReportFields
,"SETYB") == 0) {
422 if(strstr(UserReportFields
,"IN-CACHE-OUT") == 0) {
428 if(strstr(UserReportFields
,"USED_TIME") == 0) {
432 if(strstr(UserReportFields
,"%TIME") == 0) {
436 if(strncmp(tmsg
," ",1) == 0)
440 if(UserReportLimit
<=0 || count
<=UserReportLimit
) {
441 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
);
448 strcat(arqip
,usuario
);
451 if ((fp_ip
= fopen(arqip
, "r")) == 0){
452 fprintf(stderr
, "SARG: (html6) %s: %s\n",text
[45],arqip
);
456 #if defined(HAVE_FOPEN64)
457 if ((fp_ip2
= fopen64(tmp2
, "a")) == 0){
459 if ((fp_ip2
= fopen(tmp2
, "a")) == 0){
461 fprintf(stderr
, "SARG: (html7) %s: %s\n",text
[45],tmp2
);
465 while(fgets(buf
,sizeof(buf
),fp_ip
)!=NULL
) {
466 if(strstr(buf
,url
) != 0)
473 sprintf(csort
,"sort -n -T %s -k 1,1 -k 5,5 -o '%s' '%s'",TempDir
,tmp3
,tmp2
);
474 cstatus
=system(csort
);
475 if (!WIFEXITED(cstatus
) || WEXITSTATUS(cstatus
)) {
476 fprintf(stderr
, "SARG: sort command return status %d\n",WEXITSTATUS(cstatus
));
477 fprintf(stderr
, "SARG: sort command: %s\n",csort
);
481 #if defined(HAVE_FOPEN64)
482 if ((fp_ip
= fopen64(tmp3
, "r")) == 0) {
484 if ((fp_ip
= fopen(tmp3
, "r")) == 0) {
486 fprintf(stderr
, "SARG: (html8) %s: %s\n",text
[45],tmp3
);
490 fscanf(fp_ip
,"%s",user_ip
);
491 fscanf(fp_ip
,"%s",userurl
);
492 fscanf(fp_ip
,"%s",userdia
);
493 fscanf(fp_ip
,"%s",userhora
);
494 fscanf(fp_ip
,"%s",userbytes
);
495 fscanf(fp_ip
,"%s",userelap
);
497 strcpy(olduserip
,user_ip
);
499 while(!feof(fp_ip
)) {
500 if(strcmp(user_ip
,olduserip
) != 0) {
501 my_lltoa(unelap
,val2
,0);
502 sprintf(wwork1
,"%s",fixnum(unbytes
,1));
503 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
);
505 strcpy(olduserip
,user_ip
);
511 unbytes
=unbytes
+my_atoll(userbytes
);
512 unelap
=unelap
+my_atoll(userelap
);
514 fscanf(fp_ip
,"%s",user_ip
);
515 fscanf(fp_ip
,"%s",userurl
);
516 fscanf(fp_ip
,"%s",userdia
);
517 fscanf(fp_ip
,"%s",userhora
);
518 fscanf(fp_ip
,"%s",userbytes
);
519 fscanf(fp_ip
,"%s",userelap
);
528 my_lltoa(unelap
,val3
,0);
529 sprintf(wwork1
,"%s",fixnum(unbytes
,1));
530 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
);
537 fscanf(fp_in
,"%s",nacc
);
538 fscanf(fp_in
,"%s",nbytes
);
539 fscanf(fp_in
,"%s",url
);
540 fscanf(fp_in
,"%s",tmsg
);
541 fscanf(fp_in
,"%s",nelap
);
542 fscanf(fp_in
,"%s",incac
);
543 fscanf(fp_in
,"%s",oucac
);
544 // fscanf(fp_in,"%s",datestimes);
559 perc2
=tnelap
/ perc2
;
563 ouperc
=tnoucache
* 100;
564 ouperc
=ouperc
/ tnbytes
;
568 inperc
=tnincache
* 100;
569 inperc
=inperc
/ tnbytes
;
572 sprintf(wwork1
,"%s",fixnum(tnacc
,1));
573 sprintf(wwork2
,"%s",fixnum(tnbytes
,1));
574 sprintf(wwork3
,"%s",fixnum2(tnelap
,1));
576 sprintf(val2
,"%s%s",href2
,ltext110
);
577 sprintf(val3
,"%3.2f%%",perc
);
578 sprintf(val4
,"%3.2f%%",inperc
);
579 sprintf(val5
,"%3.2f%%",ouperc
);
580 sprintf(val6
,"%s",buildtime(tnelap
));
581 sprintf(val7
,"%3.2f%%",perc2
);
583 strcpy(hbc1
,"class=\"header2\"");
584 strcpy(hbc2
,"class=\"header2\"");
585 strcpy(hbc3
,"class=\"header2\"");
586 strcpy(hbc4
,"class=\"header2\"");
587 strcpy(hbc5
,"class=\"header2\"");
588 strcpy(hbc6
,"class=\"header2\"");
589 strcpy(hbc7
,"class=\"header2\"");
590 strcpy(hbc8
,"class=\"header2\"");
591 strcpy(hbc9
,"class=\"header\"");
593 if(strstr(UserReportFields
,"CONNECT") == 0) {
597 if(strstr(UserReportFields
,"BYTES") == 0) {
601 if(strstr(UserReportFields
,"MILISEC") == 0) {
605 if(strstr(UserReportFields
,"SETYB") == 0) {
609 if(strstr(UserReportFields
,"IN-CACHE-OUT") == 0) {
613 if(strstr(UserReportFields
,"IN-CACHE-OUT") == 0) {
617 if(strstr(UserReportFields
,"USED_TIME") == 0) {
621 if(strstr(UserReportFields
,"%TIME") == 0) {
626 if(strstr(UserReportFields
,"TOTAL") != 0) {
627 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
);
632 if(atoi(PerUserLimit
) > 0) {
633 if(tnbytes
> (atoi(PerUserLimit
)*1000000)) {
635 if(access(PerUserLimitFile
, R_OK
) == 0) {
636 if((fp_usr
= fopen(PerUserLimitFile
, "r")) == 0) {
637 fprintf(stderr
, "SARG: (html9) %s: %s\n",text
[45],PerUserLimitFile
);
640 while(fgets(tmp6
,sizeof(tmp6
),fp_usr
)!=NULL
) {
641 if(strstr(tmp6
,"\n") != 0)
642 tmp6
[strlen(tmp6
)-1]='\0';
643 if(strcmp(tmp6
,u2
) == 0) {
652 if((fp_usr
= fopen(PerUserLimitFile
, "a")) == 0) {
653 fprintf(stderr
, "SARG: (html10) %s: %s\n",text
[45],PerUserLimitFile
);
656 fprintf(fp_usr
,"%s\n",u2
);
660 sprintf(msg
, "%s %s %s (%s MB). %s %s",text
[32],u2
,text
[74],PerUserLimit
,text
[75],PerUserLimitFile
);
672 if (strstr(ReportType
,"topuser") != 0) {
673 strcpy(arqper
,dirname
);
674 strcat(arqper
,"/sarg-users");
676 if ((fp_in
= fopen(arqper
, "r")) == 0){
677 fprintf(stderr
, "SARG: (html11) %s: %s\n",text
[45],arqper
);
681 fgets(totuser
,8,fp_in
);
684 totbytes2
=totbytes
/my_atoll(totuser
);
685 totelap2
=totelap
/my_atoll(totuser
);
688 perc
= totbytes
/ 100;
689 perc
= totbytes2
/ perc
;
693 perc2
= totelap
/ 100;
694 perc2
= totelap2
/ perc2
;
697 twork2
=my_atoll(totuser
);
700 sprintf(wwork1
,"%s",fixnum(twork
,1));
701 sprintf(wwork2
,"%s",fixnum(totbytes2
,1));
702 sprintf(wwork3
,"%s",fixnum2(totelap2
,1));
704 sprintf(val6
,"%s",buildtime(totelap2
));
705 sprintf(val7
,"%3.2f%%",perc2
);
707 strcpy(hbc1
,"class=\"header2\"");
708 strcpy(hbc2
,"class=\"header2\"");
709 strcpy(hbc3
,"class=\"header2\"");
710 strcpy(hbc4
,"class=\"header2\"");
711 strcpy(hbc5
,"class=\"header2\"");
712 strcpy(hbc6
,"class=\"header\"");
714 if(strstr(UserReportFields
,"CONNECT") == 0) {
718 if(strstr(UserReportFields
,"BYTES") == 0) {
722 if(strstr(UserReportFields
,"MILISEC") == 0) {
726 if(strstr(UserReportFields
,"USED_TIME") == 0) {
730 if(strstr(UserReportFields
,"%TIME") == 0) {
735 if(strstr(UserReportFields
,"AVERAGE") != 0) {
736 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
);
745 fputs("</center></table>\n",fp_ou
);
749 fputs("</body>\n</html>\n",fp_ou
);
757 (void)rewinddir(dirp
);
758 (void)closedir(dirp
);