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