]> git.ipfire.org Git - thirdparty/sarg.git/blob - report.c
Use boolean to enable all the options instead of string compares.
[thirdparty/sarg.git] / report.c
1 /*
2 * AUTHOR: Pedro Lineu Orso pedro.orso@gmail.com
3 * 1998, 2009
4 * SARG Squid Analysis Report Generator http://sarg.sourceforge.net
5 *
6 * SARG donations:
7 * please look at http://sarg.sourceforge.net/donations.php
8 * ---------------------------------------------------------------------
9 *
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.
14 *
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.
19 *
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.
23 *
24 */
25
26 #include "include/conf.h"
27 #include "include/defs.h"
28
29 static void maketmp(const char *user, const char *dirname, int debug, int indexonly);
30 static void maketmp_hour(const char *user, const char *dirname, int indexonly);
31 static void gravatmp_hora(const char *dirname, const char *user, const char *data, const char *hora, long long int elap, long long int accbytes, int indexonly);
32 static void gravatmpf(const char *oldaccuser, const char *dirname, const char *oldurl, long long int nacc, long long int nbytes, const char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache);
33 static void gravaporuser(const char *user, const char *dirname, const char *url, const char *ip, const char *data, const char *hora, long long int tam, long long int elap, int indexonly);
34 static void gravager(FILE *fp_gen, const char *user, long long int nacc, const char *url, long long int nbytes, const char *ip, const char *hora, const char *dia, long long int nelap, long long int incache, long long int oucache);
35 static void grava_SmartFilter(const char *dirname, const char *user, const char *ip, const char *data, const char *hora, const char *url, const char *smart);
36
37 void gerarel(void)
38 {
39
40 FILE *fp_in;
41 FILE *fp_gen;
42
43 char accdia[11], acchora[9], accuser[MAXLEN], accip[MAXLEN], accurl[MAXLEN];
44 char oldaccdia[11], oldacchora[9], oldaccip[MAXLEN];
45 char wdirname[MAXLEN], oldurl[MAXLEN], oldaccuser[MAXLEN];
46 char olduser[MAXLEN], oldmsg[50], acccode[MAXLEN/2 - 1], oldacccode[MAXLEN/2 - 1], user[MAXLEN];
47 char ipantes[MAXLEN], nameantes[MAXLEN];
48 char accsmart[MAXLEN];
49 char crc2[MAXLEN/2 -1];
50 long long int nbytes=0;
51 long long int nelap=0;
52 long long int nacc=0;
53 long long int rtotal=0;
54 long long int incache=0;
55 long long int oucache=0;
56 long long int accbytes, accelap;
57 char *str;
58 DIR *dirp;
59 struct dirent *direntp;
60 const char logext[]=".log";
61 int dlen;
62 char siteind[MAXLEN];
63 struct getwordstruct gwarea;
64
65 ipantes[0]='\0';
66 nameantes[0]='\0';
67 smartfilter=0;
68
69 sprintf(dirname, "%s%s", outdir, period);
70 vrfydir(period, addr, site, us, email);
71
72 if(debugz){
73 debugaz("dirname",dirname);
74 }
75
76 gperiod(dirname,period);
77
78 if(UserAgentLog[0] != '\0' && email[0] == '\0') useragent();
79
80 sprintf(wdirname,"%s/sarg-general",dirname);
81 if((fp_gen=MY_FOPEN(wdirname,"a"))==NULL){
82 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
83 exit(1);
84 }
85
86 olduser[0]='\0';
87 strncat(tmp,"/sarg",5);
88
89 dirp = opendir(tmp);
90 while ((direntp = readdir( dirp )) != NULL ) {
91 dlen=strlen(direntp->d_name)-(sizeof(logext)-1);
92 if (dlen<0) continue;
93 if((strcmp(direntp->d_name+dlen,logext) != 0) ||
94 (strncmp(direntp->d_name,"download.log",12) == 0) ||
95 (strncmp(direntp->d_name,"denied.log",10) == 0) ||
96 (strncmp(direntp->d_name,"authfail.log.unsort",19) == 0))
97 continue;
98 if (snprintf(tmp3,sizeof(tmp3),"%s/%s",tmp,direntp->d_name)>=sizeof(tmp3)) {
99 fprintf(stderr, "SARG: (report) directory entry too long: %s/%s\n",tmp,direntp->d_name);
100 exit(1);
101 }
102 if((fp_in=MY_FOPEN(tmp3,"r"))==NULL){
103 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],tmp);
104 exit(1);
105 }
106
107 if (dlen>0) {
108 if (dlen>=sizeof(user)) continue;
109 strncpy(user,direntp->d_name,dlen);
110 user[dlen]=0;
111 } else {
112 user[0]='\0';
113 }
114
115 strcpy(wdirname,dirname);
116 maketmp(user,tmp,debug,indexonly);
117 maketmp_hour(user,tmp,indexonly);
118
119 strcpy(u2,user);
120 if(Ip2Name)
121 ip2name(u2,sizeof(u2));
122 get_usertab_name(u2,name,sizeof(name));
123
124 if(dotinuser && strchr(name,'_')) {
125 subs(name,sizeof(name),"_",".");
126 }
127
128 ttopen=0;
129 bzero(html_old, MAXLEN);
130
131 while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
132 getword_start(&gwarea,buf);
133 if (getword(accdia,sizeof(accdia),&gwarea,'\t')<0 || getword(acchora,sizeof(acchora),&gwarea,'\t')<0 ||
134 getword(accuser,sizeof(accuser),&gwarea,'\t')<0 || getword(accip,sizeof(accip),&gwarea,'\t')<0 ||
135 getword(accurl,sizeof(accurl),&gwarea,'\t')<0 || getword_atoll(&accbytes,&gwarea,'\t')<0 ||
136 getword(acccode,sizeof(acccode),&gwarea,'\t')<0) {
137 printf("SARG: Maybe you have a broken record or garbage in your %s file (%d).\n",tmp3,__LINE__);
138 exit(1);
139 }
140 if(strncmp(acccode,"TCP_DENIED/407",14) == 0) continue;
141 if (getword_atoll(&accelap,&gwarea,'\t')<0 || getword_skip(20000,&gwarea,'\t')<0) {
142 printf("SARG: Maybe you have a broken elapsed time in your %s file (%d).\n",tmp3,__LINE__);
143 exit(1);
144 }
145 if (getword(accsmart,sizeof(accsmart),&gwarea,'"')<0) {
146 printf("SARG: Maybe you have a broken smart info in your %s file (%d).\n",tmp3,__LINE__);
147 exit(1);
148 }
149
150 if(accsmart[0] != '\0') {
151 smartfilter++;
152 strcpy(wdirname,dirname);
153 grava_SmartFilter(wdirname,accuser,accip,accdia,acchora,accurl,accsmart);
154 }
155
156 if(Ip2Name) {
157 if(strcmp(accip,ipantes) != 0) {
158 strcpy(ipantes,accip);
159 ip2name(accip,sizeof(accip));
160 strcpy(nameantes,accip);
161 } else strcpy(accip,nameantes);
162 }
163
164 strcpy(wdirname,dirname);
165 gravatmp_hora(wdirname,accuser,accdia,acchora,accelap,accbytes,indexonly);
166
167 if(iprel){
168 strcpy(wdirname,dirname);
169 gravaporuser(accuser,wdirname,accurl,accip,accdia,acchora,accbytes,accelap,indexonly);
170 }
171
172 if(!rtotal){
173 strcpy(oldurl,accurl);
174 strcpy(oldacccode,acccode);
175 strcpy(oldaccuser,accuser);
176 strcpy(oldaccip,accip);
177 strcpy(oldaccdia,accdia);
178 strcpy(oldacchora,acchora);
179 rtotal++;
180 }
181
182 if(site[0] != '\0') {
183 if(strcmp(oldaccuser,accuser) != 0){
184 strcpy(oldmsg,"OK");
185 if(strstr(oldacccode,"DENIED") != 0)
186 sprintf(oldmsg,"%s",text[46]);
187 gravatmp(oldaccuser,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache);
188 gravager(fp_gen,oldaccuser,nacc,oldurl,nbytes,oldaccip,oldacchora,oldaccdia,nelap,incache,oucache);
189 nacc=0;
190 nbytes=0;
191 nelap=0;
192 incache=0;
193 oucache=0;
194 }
195 } else {
196 if(strcmp(oldurl,accurl) != 0 || strcmp(oldaccuser,accuser) != 0){
197 strcpy(oldmsg,"OK");
198 if(strstr(oldacccode,"DENIED") != 0)
199 sprintf(oldmsg,"%s",text[46]);
200 gravatmp(oldaccuser,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache);
201 gravager(fp_gen,oldaccuser,nacc,oldurl,nbytes,oldaccip,oldacchora,oldaccdia,nelap,incache,oucache);
202 nacc=0;
203 nbytes=0;
204 nelap=0;
205 incache=0;
206 oucache=0;
207 if(strcmp(oldaccuser,accuser) != 0)
208 ind2=0;
209 }
210 }
211 nacc++;
212 nbytes+=accbytes;
213 nelap+=accelap;
214
215 if(strstr(ReportType,"site_user_time_date") != 0) {
216 if(!ttopen) {
217 ind2++;
218 strcpy(siteind,accurl);
219 for(str=siteind; *str; str++) {
220 if(*str=='?' || *str=='-' || *str=='.' || *str==':' || *str=='/' || *str=='\\' || *str=='*' ||
221 *str=='\'' || *str=='\"' || *str=='$')
222 *str='_';
223 }
224 sprintf(arqtt,"%s/%s",dirname,accuser);
225 if(access(arqtt, R_OK) != 0)
226 my_mkdir(arqtt);
227 sprintf(arqtt,"%s/%s/tt%s-%s.html",dirname,accuser,accuser,siteind);
228 if(strlen(arqtt) > 255) {
229 arqtt[255]='\0';
230 }
231 if ((fp_tt = fopen(arqtt, "w")) == 0) {
232 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],arqtt);
233 exit(1);
234 }
235 ttopen=1;
236
237 /*
238 if(Privacy)
239 sprintf(httplink,"<font size=%s color=%s><href=http://%s>%s", \
240 FontSize,PrivacyStringColor,PrivacyString,PrivacyString);
241 else
242 sprintf(httplink,"<font size=%s><a href=\"http://%s\">%s</a>",FontSize,accurl,accurl);
243 */
244
245 sprintf(ltext110,"%s",text[110]);
246 for(str=ltext110; *str; ++str)
247 *str=tolower(*str);
248
249 fprintf(fp_tt, "<!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);
250 css(fp_tt);
251 fputs("</head>\n",fp_tt);
252 fprintf(fp_tt,"<body bgcolor=\"%s\" text=\"%s\" background=\"%s\">\n",BgColor,TxColor,BgImage);
253 write_logo_image(fp_tt);
254
255 if(strcmp(IndexTree,"date") == 0)
256 show_sarg(fp_tt, "../../../..");
257 else
258 show_sarg(fp_tt, "../..");
259
260 fputs("<div align=\"center\"><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_tt);
261 fprintf(fp_tt,"<tr><th class=\"title\" colspan=\"2\">%s</th></tr>\n",Title);
262
263 fprintf(fp_tt,"<tr><td class=\"header\" colspan=\"2\">%s:&nbsp;%s</td></tr>\n",text[89],period);
264 fprintf(fp_tt,"<tr><td class=\"header\" colspan=\"2\">%s:&nbsp;%s</td></tr>\n",text[90],name);
265 fprintf(fp_tt,"<tr><td class=\"header\" colspan=\"2\">%s:&nbsp;%s, %s</td></tr>\n",text[104],UserSortField,UserSortOrder);
266 fprintf(fp_tt,"<tr><th class=\"header3\" colspan=\"2\">%s</th></tr>\n",text[32]);
267
268 fputs("</table></div>\n",fp_tt);
269 fputs("<div align=\"center\"><table cellpadding=\"0\" cellspacing=\"2\">\n",fp_tt);
270 fputs("<tr><td></td><td></td></tr>",fp_tt);
271 bzero(tmp4, MAXLEN);
272 strncpy(tmp4,text[110],4);
273 fprintf(fp_tt,"<tr><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th></tr>\n",text[91],tmp4,text[110]+5);
274 }
275
276 sprintf(html,"<tr><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td></tr>\n",accurl,accdia,acchora);
277
278 if(strcmp(html,html_old) != 0)
279 fputs(html,fp_tt);
280 strcpy(html_old, html);
281 } else bzero(ltext110, 50);
282
283 strcpy(crc2,acccode);
284 str=strchr(crc2,'/');
285 if (str) *str='\0';
286
287 if(strstr(crc2,"MISS") != 0)
288 oucache+=accbytes;
289 else incache+=accbytes;
290
291 strcpy(oldurl,accurl);
292
293 if(strcmp(accuser,oldaccuser) != 0) {
294 strcpy(wdirname,dirname);
295 day_totalize(tmp,oldaccuser,indexonly);
296 }
297
298 strcpy(oldaccuser,accuser);
299 strcpy(oldacccode,acccode);
300 strcpy(oldaccip,accip);
301 strcpy(oldaccdia,accdia);
302 strcpy(oldacchora,acchora);
303
304 }
305 bzero(user,MAXLEN);
306 fclose(fp_in);
307 unlink(tmp3);
308 }
309 closedir(dirp);
310
311 strcpy(oldmsg,"OK");
312 if(strstr(oldacccode,"DENIED") != 0)
313 sprintf(oldmsg,"%s",text[46]);
314 strcpy(wdirname,dirname);
315 if(strlen(oldaccuser) == 0)
316 strcpy(oldaccuser,accuser);
317 gravatmpf(oldaccuser,wdirname,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache);
318 strcpy(wdirname,dirname);
319 gravager(fp_gen,oldaccuser,nacc,oldurl,nbytes,oldaccip,oldacchora,oldaccdia,nelap,incache,oucache);
320 fclose(fp_gen);
321 day_totalize(tmp,oldaccuser,indexonly);
322
323 tmpsort();
324
325 strcpy(wdirname,dirname);
326 totalger(wdirname, debug, outdir);
327
328 if(email[0] == '\0') {
329 if(strstr(ReportType,"downloads") != 0) download_report();
330
331 if(strlen(DansGuardianConf) > 0) {
332 strcpy(wdirname,dirname);
333 dansguardian_log();
334 }
335
336 strcpy(wdirname,dirname);
337 squidguard_log();
338
339 strcpy(wdirname,dirname);
340 topuser();
341
342 if(strstr(ReportType,"topsites") != 0) topsites();
343
344 if(strstr(ReportType,"sites_users") != 0) siteuser();
345 gen_denied_report();
346
347 strcpy(wdirname,dirname);
348 authfail_report();
349
350 if(smartfilter) smartfilter_report();
351
352 if(strlen(DansGuardianConf) > 0) dansguardian_report();
353
354 squidguard_report();
355
356 if(strstr(ReportType,"users_sites") != 0) htmlrel();
357
358 make_index();
359
360 if(SuccessfulMsg) fprintf(stderr, "SARG: %s %s\n",text[47],dirname);
361 } else {
362 strcpy(wdirname,dirname);
363 geramail(wdirname, debug, outdir, userip, email, TempDir);
364
365 if((strcmp(email,"stdout") != 0) && SuccessfulMsg)
366 fprintf(stderr, "SARG: %s %s\n",text[48],email);
367 }
368
369 if(indexonly) {
370 strcpy(wdirname,dirname);
371 index_only(wdirname, debug);
372 }
373
374 /*
375 2009-10-13(Frederic) This piece of code is never called so it is commented out for good.
376 if(strlen(email) < 0)
377 removetmp(dirname);
378 */
379
380 return;
381 }
382
383 static void maketmp(const char *user, const char *dirname, int debug, int indexonly)
384 {
385
386 FILE *fp_ou;
387
388 char wdirname[MAXLEN];
389
390 if(indexonly) return;
391 if(strstr(ReportType,"users_sites") == 0) return;
392
393 strcpy(wdirname,tmp);
394 strcat(wdirname,"/");
395 strcat(wdirname,user);
396
397 if(debug){
398 debuga("%s: %s",text[49],wdirname);
399 }
400
401 strcat(wdirname,".utmp");
402 if((fp_ou=fopen(wdirname,"w"))==NULL){
403 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
404 exit(1);
405 }
406
407 fclose(fp_ou);
408 return;
409 }
410
411
412 static void maketmp_hour(const char *user, const char *dirname, int indexonly)
413 {
414
415 FILE *fp_ou;
416
417 char wdirname[MAXLEN];
418
419 if(indexonly) return;
420 if(strstr(ReportType,"users_sites") == 0) return;
421
422 strcpy(wdirname,tmp);
423 strcat(wdirname,"/");
424 strcat(wdirname,user);
425
426 strcat(wdirname,".htmp");
427 if((fp_ou=fopen(wdirname,"w"))==NULL){
428 fprintf(stderr, "SARG: (report-1) %s: %s - %s\n",text[45],wdirname,strerror(errno));
429 exit(1);
430 }
431
432 fclose(fp_ou);
433 return;
434 }
435
436
437 void gravatmp(const char *oldaccuser, const char *oldurl, long long int nacc, long long int nbytes, const char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache)
438 {
439
440 FILE *fp_ou;
441 char val1[16];
442 char val2[16];
443 char val3[16];
444 char val4[16];
445 char val5[16];
446 char wdirname[MAXLEN];
447
448 if(indexonly) return;
449 if(strstr(ReportType,"users_sites") == 0) return;
450
451 if (snprintf(wdirname,sizeof(wdirname),"%s/%s.utmp",tmp,oldaccuser)>=sizeof(wdirname)) {
452 fprintf(stderr,"SARG: Path too long %s/%s.utmp\n",tmp,oldaccuser);
453 exit(1);
454 }
455
456 if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){
457 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
458 exit(1);
459 }
460
461 my_lltoa(nacc,val1,0);
462 my_lltoa(nbytes,val2,0);
463 my_lltoa(nelap,val3,0);
464 my_lltoa(incache,val4,0);
465 my_lltoa(oucache,val5,0);
466 fprintf(fp_ou,"%s\t%s\t%s\t%s\t%s\t%s\t%s\n",val1,val2,oldurl,oldmsg,val3,val4,val5);
467
468 fclose(fp_ou);
469 ttopen=0;
470
471 if(fp_tt) {
472 fputs("</table>\n",fp_tt);
473 fputs("</body>\n</html>\n",fp_tt);
474 fclose(fp_tt);
475 }
476
477 return;
478
479 }
480
481
482 static void gravatmp_hora(const char *dirname, const char *user, const char *data, const char *hora, long long int elap, long long int bytes, int indexonly)
483 {
484
485 FILE *fp_ou;
486 char wdirname[MAXLEN];
487
488 if(indexonly || (strstr(ReportType,"users_sites") == 0)) return;
489
490 if (snprintf(wdirname,sizeof(wdirname),"%s/%s.htmp",tmp,user)>=sizeof(wdirname)) {
491 fprintf(stderr,"SARG: Path too long %s/%s.htmp\n",tmp,user);
492 exit(1);
493 }
494
495 if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){
496 fprintf(stderr, "SARG: (report-2) %s: %s - %s\n",text[45],wdirname,strerror(errno));
497 exit(1);
498 }
499
500 if(strcmp(datetimeby,"bytes") == 0) fprintf(fp_ou,"%s\t%s\t%lld\n",data,hora,bytes);
501 else fprintf(fp_ou,"%s\t%s\t%lld\n",data,hora,elap);
502
503 fclose(fp_ou);
504
505 return;
506 }
507
508
509 static void gravaporuser(const char *user, const char *dirname, const char *url, const char *ip, const char *data, const char *hora, long long int tam, long long int elap, int indexonly)
510 {
511
512 FILE *fp_ou;
513 char wdirname[MAXLEN];
514
515 if(indexonly || (strstr(ReportType,"users_sites") == 0)) return;
516
517 if (snprintf(wdirname,sizeof(wdirname),"%s/%s.ip",tmp,user)>=sizeof(wdirname)) {
518 fprintf(stderr,"SARG: Path too long %s/%s.ip\n",tmp,user);
519 exit(1);
520 }
521
522 if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){
523 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
524 exit(1);
525 }
526
527 fprintf(fp_ou,"%s\t%s\t%s\t%s\t%lld\t%lld\n",ip,url,data,hora,tam,elap);
528
529 fclose(fp_ou);
530
531 return;
532
533 }
534
535
536 static void gravatmpf(const char *oldaccuser, const char *dirname, const char *oldurl, long long int nacc, long long int nbytes, const char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache)
537 {
538
539 FILE *fp_ou;
540 char wdirname[MAXLEN];
541
542 if(indexonly || (strstr(ReportType,"users_sites") == 0)) return;
543
544 if (snprintf(wdirname,sizeof(wdirname),"%s/%s.utmp",tmp,oldaccuser)>=sizeof(wdirname)) {
545 fprintf(stderr,"SARG: Path too long %s/%s.utmp\n",tmp,oldaccuser);
546 exit(1);
547 }
548
549 if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){
550 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
551 exit(1);
552 }
553
554 my_lltoa(nacc,val1,0);
555 my_lltoa(nbytes,val2,0);
556 my_lltoa(nelap,val3,0);
557 my_lltoa(incache,val4,0);
558 my_lltoa(oucache,val5,0);
559 fprintf(fp_ou,"%s\t%s\t%s\t%s\t%s\t%s\t%s\n",val1,val2,oldurl,oldmsg,val3,val4,val5);
560
561 fclose(fp_ou);
562 ttopen=0;
563 ind2=0;
564
565 if(fp_tt) {
566 fputs("</table>\n",fp_tt);
567 fputs("</body>\n</html>\n",fp_tt);
568 fclose(fp_tt);
569 }
570
571 return;
572
573 }
574
575
576 static void gravager(FILE *fp_gen, const char *user, long long int nacc, const char *url, long long int nbytes, const char *ip, const char *hora, const char *dia, long long int nelap, long long int incache, long long int oucache)
577 {
578 my_lltoa(nacc,val1,0);
579 my_lltoa(nbytes,val2,0);
580 my_lltoa(nelap,val3,0);
581 my_lltoa(incache,val4,0);
582 my_lltoa(oucache,val5,0);
583 fprintf(fp_gen,"%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",user,val1,val2,url,ip,hora,dia,val3,val4,val5);
584 return;
585
586 }
587
588 static void grava_SmartFilter(const char *dirname, const char *user, const char *ip, const char *data, const char *hora, const char *url, const char *smart)
589 {
590
591 FILE *fp_ou;
592 char wdirname[MAXLEN];
593
594 sprintf(wdirname,"%s/smartfilter.unsort",dirname);
595
596 if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){
597 fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
598 exit(1);
599 }
600
601 fprintf(fp_ou,"%s\t%s\t%s\t%s\t%s\t%s\n",user,data,hora,ip,url,smart);
602 fputs("</body>\n</html>\n",fp_tt);
603
604 fclose(fp_ou);
605
606 return;
607
608 }