2 * SARG Squid Analysis Report Generator http://sarg.sourceforge.net
6 * please look at http://sarg.sourceforge.net/donations.php
8 * http://sourceforge.net/projects/sarg/forums/forum/363374
9 * ---------------------------------------------------------------------
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.
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.
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.
27 #include "include/conf.h"
28 #include "include/defs.h"
30 //! The global statistics of the whole log read.
31 struct globalstatstruct globstat
;
32 //! \c True to enable the smart filter.
33 bool smartfilter
=false;
35 //! The file to store the HTML page where the time of access is reported for one site and one user.
36 static FILE *fp_tt
=NULL
;
37 //! The name of the file containing the access time of the site/user.
38 static char arqtt
[4096]="";
40 static FILE *maketmp(const char *user
, const char *dirname
, int debug
);
41 static void gravatmp(FILE *fp_ou
, const char *oldurl
, long long int nacc
, long long int nbytes
, const char *oldmsg
, long long int nelap
, long long int incache
, long long int oucache
);
42 static void gravaporuser(const struct userinfostruct
*uinfo
, const char *dirname
, const char *url
, const char *ip
, const char *data
, const char *hora
, long long int tam
, long long int elap
);
43 static void gravager(FILE *fp_gen
,const char *filename
, const struct userinfostruct
*uinfo
, 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
);
44 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
);
53 char accdia
[11], acchora
[9], accip
[256], *accurl
;
54 char oldaccdia
[11], oldacchora
[9], oldaccip
[256];
56 char wdirname
[MAXLEN
];
58 char oldmsg
[50], acccode
[MAXLEN
/2 - 1], oldacccode
[MAXLEN
/2 - 1];
59 char ipantes
[256], nameantes
[MAXLEN
];
60 char accsmart
[MAXLEN
];
61 char crc2
[MAXLEN
/2 -1];
62 char siteind
[MAX_TRUNCATED_URL
];
64 char oldaccdiatt
[11],oldacchoratt
[9];
66 char u2
[MAX_USER_LEN
];
67 char userlabel
[MAX_USER_LEN
];
68 long long int nbytes
=0;
69 long long int nelap
=0;
71 long long int incache
=0;
72 long long int oucache
=0;
73 long long int accbytes
, accelap
;
76 const char *sort_field
;
77 const char *sort_order
;
84 struct getwordstruct gwarea
;
86 struct userinfostruct
*uinfo
;
91 memset(&globstat
,0,sizeof(globstat
));
93 if (vrfydir(&period
, addr
, site
, us
, email
)<0) {
94 debuga(_("Cannot create the output directory name containing the period as part of the name\n"));
99 debugaz(_("outdirname=%s\n"),outdirname
);
102 if(UserAgentLog
[0] != '\0' && email
[0] == '\0') useragent();
104 snprintf(wdirname
,sizeof(wdirname
),"%s/sarg-general",outdirname
);
105 if((fp_gen
=MY_FOPEN(wdirname
,"w"))==NULL
){
106 debuga(_("(report) Cannot open file %s: %s\n"),wdirname
,strerror(errno
));
111 sort_labels(&sort_field
,&sort_order
);
113 if (indexonly
|| datetimeby
==0)
116 daystat
=day_prepare();
118 uscan
=userinfo_startscan();
120 debuga(_("Cannot enumerate the user list\n"));
123 while ((uinfo
= userinfo_advancescan(uscan
)) != NULL
) {
124 sort_users_log(tmp
,debug
,uinfo
);
125 if (snprintf(tmp3
,sizeof(tmp3
),"%s/%s.user_log",tmp
,uinfo
->filename
)>=sizeof(tmp3
)) {
126 debuga(_("(report) directory entry too long: %s/%s.user_log\n"),tmp
,uinfo
->filename
);
129 if((fp_in
=MY_FOPEN(tmp3
,"r"))==NULL
){
130 debuga(_("(report) Cannot open file %s: %s\n"),tmp
,strerror(errno
));
133 user
=uinfo
->filename
;
134 day_newuser(daystat
);
136 strcpy(u2
,uinfo
->id
);
137 if(Ip2Name
&& uinfo
->id_is_ip
) {
138 safe_strcpy(ipantes
,u2
,sizeof(ipantes
));
139 ip2name(u2
,sizeof(u2
));
140 strcpy(nameantes
,u2
);
142 user_find(userlabel
,MAX_USER_LEN
, u2
);
143 userinfo_label(uinfo
,userlabel
);
146 fp_tmp
=maketmp(user
,tmp
,debug
);
153 memset(oldaccdiatt
,0,sizeof(oldaccdiatt
));
154 memset(oldacchoratt
,0,sizeof(oldacchoratt
));
155 memset(oldacciptt
,0,sizeof(oldacciptt
));
163 if ((line
=longline_create())==NULL
) {
164 debuga(_("Not enough memory to read the downloaded files\n"));
168 while((buf
=longline_read(fp_in
,line
))!=NULL
) {
169 getword_start(&gwarea
,buf
);
170 if (getword(accdia
,sizeof(accdia
),&gwarea
,'\t')<0 || getword(acchora
,sizeof(acchora
),&gwarea
,'\t')<0 ||
171 getword(accip
,sizeof(accip
),&gwarea
,'\t')<0 ||
172 getword_ptr(buf
,&accurl
,&gwarea
,'\t')<0 || getword_atoll(&accbytes
,&gwarea
,'\t')<0 ||
173 getword(acccode
,sizeof(acccode
),&gwarea
,'\t')<0) {
174 debuga(_("There is a broken record or garbage in file %s\n"),tmp3
);
177 if(strncmp(acccode
,"TCP_DENIED/407",14) == 0) continue;
178 if (getword_atoll(&accelap
,&gwarea
,'\t')<0) {
179 debuga(_("There is a broken elapsed time in file %s\n"),tmp3
);
182 if (getword_skip(20000,&gwarea
,'"')<0 || getword(accsmart
,sizeof(accsmart
),&gwarea
,'"')<0) {
183 debuga(_("There is a broken smart info in file %s\n"),tmp3
);
187 if(accsmart
[0] != '\0') {
189 grava_SmartFilter(tmp
,uinfo
->id
,accip
,accdia
,acchora
,accurl
,accsmart
);
193 if(strcmp(accip
,ipantes
) != 0) {
194 strcpy(ipantes
,accip
);
195 ip2name(accip
,sizeof(accip
));
196 strcpy(nameantes
,accip
);
197 } else safe_strcpy(accip
,nameantes
,sizeof(accip
));
201 day_addpoint(daystat
,accdia
,acchora
,accelap
,accbytes
);
202 if (iprel
) gravaporuser(uinfo
,outdirname
,accurl
,accip
,accdia
,acchora
,accbytes
,accelap
);
206 url_len
=strlen(accurl
);
207 if (!oldurl
|| url_len
>=ourl_size
) {
209 oldurl
=realloc(oldurl
,ourl_size
);
211 debuga(_("Not enough memory to store the url\n"));
215 strcpy(oldurl
,accurl
);
216 strcpy(oldacccode
,acccode
);
217 strcpy(oldaccip
,accip
);
218 strcpy(oldaccdia
,accdia
);
219 strcpy(oldacchora
,acchora
);
222 same_url
=(strcmp(oldurl
,accurl
) == 0);
224 if(site
[0] == '\0') {
226 if(strstr(oldacccode
,"DENIED") != 0)
227 strcpy(oldmsg
,"DENIED");
230 if (fp_tmp
) gravatmp(fp_tmp
,oldurl
,nacc
,nbytes
,oldmsg
,nelap
,incache
,oucache
);
231 gravager(fp_gen
,wdirname
,uinfo
,nacc
,oldurl
,nbytes
,oldaccip
,oldacchora
,oldaccdia
,nelap
,incache
,oucache
);
243 if ((ReportType
& REPORT_TYPE_SITE_USER_TIME_DATE
) != 0 && !indexonly
&&
244 (!oldurltt
|| strcmp(oldurltt
,accurl
) || strcmp(oldaccdiatt
,accdia
) || strcmp(oldacchoratt
,acchora
) ||
245 strcmp(oldacciptt
,accip
))) {
248 snprintf(arqtt
,sizeof(arqtt
),"%s/%s",outdirname
,uinfo
->filename
);
249 if(access(arqtt
, R_OK
) != 0)
251 url_to_file(accurl
,siteind
,sizeof(siteind
));
252 snprintf(arqtt
,sizeof(arqtt
),"%s/%s/tt%s-%s.html",outdirname
,uinfo
->filename
,uinfo
->filename
,siteind
);
253 if ((fp_tt
= fopen(arqtt
, "w")) == 0) {
254 debuga(_("(report) Cannot open file %s: %s\n"),arqtt
,strerror(errno
));
261 sprintf(httplink,"<font size=%s color=%s><href=http://%s>%s",FontSize,PrivacyStringColor,PrivacyString,PrivacyString);
263 sprintf(httplink,"<font size=%s><a href=\"http://%s\">%s</a>",FontSize,accurl,accurl);
266 write_html_header(fp_tt
,(IndexTree
== INDEX_TREE_DATE
) ? 4 : 2,_("Site access report"),HTML_JS_NONE
);
267 fprintf(fp_tt
,"<tr><td class=\"header_c\">%s: %s</td></tr>\n",_("Period"),period
.html
);
268 fprintf(fp_tt
,"<tr><td class=\"header_c\">%s: %s</td></tr>\n",_("User"),uinfo
->label
);
269 fputs("<tr><td class=\"header_c\">",fp_tt
);
270 fprintf(fp_tt
,_("Sort: %s, %s"),sort_field
,sort_order
);
271 fputs("</td></tr>\n",fp_tt
);
272 fprintf(fp_tt
,"<tr><th class=\"header_c\">%s</th></tr>\n",_("User"));
273 close_html_header(fp_tt
);
275 fputs("<div class=\"report\"><table cellpadding=\"0\" cellspacing=\"2\">\n",fp_tt
);
276 fprintf(fp_tt
,"<tr><th class=\"header_l\">%s</th>",_("ACCESSED SITE"));
277 fprintf(fp_tt
,"<th class=\"header_l\">%s</th>",_("IP"));
278 fprintf(fp_tt
,"<th class=\"header_l\">%s</th><th class=\"header_l\">%s</th></tr>\n",_("DATE"),_("TIME"));
281 fputs("<tr><td class=\"data\">",fp_tt
);
282 output_html_string(fp_tt
,accurl
,100);
283 fputs("</td>",fp_tt
);
284 fprintf(fp_tt
,"<td class=\"data\">%s</td>",accip
);
285 fprintf(fp_tt
,"<td class=\"data\">%s</td><td class=\"data\">%s</td></tr>\n",accdia
,acchora
);
287 url_len
=strlen(accurl
);
288 if (!oldurltt
|| url_len
>=ourltt_size
) {
289 ourltt_size
=url_len
+1;
290 oldurltt
=realloc(oldurltt
,ourltt_size
);
292 debuga(_("Not enough memory to store the url\n"));
296 strcpy(oldurltt
,accurl
);
297 strcpy(oldaccdiatt
,accdia
);
298 strcpy(oldacchoratt
,acchora
);
299 strcpy(oldacciptt
,accip
);
302 strcpy(crc2
,acccode
);
303 str
=strchr(crc2
,'/');
305 if(strstr(crc2
,"MISS") != 0)
310 strcpy(oldacccode
,acccode
);
311 strcpy(oldaccip
,accip
);
313 url_len
=strlen(accurl
);
314 if (url_len
>=ourl_size
) {
316 oldurl
=realloc(oldurl
,ourl_size
);
318 debuga(_("Not enough memory to store the url\n"));
322 strcpy(oldurl
,accurl
);
324 strcpy(oldaccdia
,accdia
);
325 strcpy(oldacchora
,acchora
);
328 longline_destroy(&line
);
329 if (oldurltt
) free(oldurltt
);
331 if(strstr(oldacccode
,"DENIED") != 0)
332 strcpy(oldmsg
,"DENIED");
335 if (fp_tmp
) gravatmp(fp_tmp
,oldurl
,nacc
,nbytes
,oldmsg
,nelap
,incache
,oucache
);
336 gravager(fp_gen
,wdirname
,uinfo
,nacc
,oldurl
,nbytes
,oldaccip
,oldacchora
,oldaccdia
,nelap
,incache
,oucache
);
341 day_totalize(daystat
,tmp
,uinfo
);
344 if (fclose(fp_tmp
)==EOF
) {
345 debuga(_("Failed to close temporary file for user %s: %s\n"),uinfo
->filename
,strerror(errno
));
350 if (!KeepTempLog
&& unlink(tmp3
)) {
351 debuga(_("Cannot delete \"%s\": %s\n"),tmp3
,strerror(errno
));
355 userinfo_stopscan(uscan
);
356 day_cleanup(daystat
);
358 totalger(fp_gen
,wdirname
);
359 if (fclose(fp_gen
)==EOF
) {
360 debuga(_("Write error in %s: %s\n"),wdirname
,strerror(errno
));
364 if(email
[0] == '\0') {
366 if(DansGuardianConf
[0] != '\0')
369 debugaz(_("Dansguardian report not produced because no dansguardian configuration file was provided\n"));
377 if((ReportType
& REPORT_TYPE_DOWNLOADS
) != 0)
380 debugaz(_("Downloaded files report not requested in report_type\n"));
382 if((ReportType
& REPORT_TYPE_TOPSITES
) != 0)
385 debugaz(_("Top sites report not requested in report_type\n"));
387 if((ReportType
& REPORT_TYPE_SITES_USERS
) != 0)
390 debugaz(_("Sites & users report not requested in report_type\n"));
392 if ((ReportType
& REPORT_TYPE_DENIED
) != 0)
395 debugaz(_("Denied accesses report not requested in report_type\n"));
397 if ((ReportType
& REPORT_TYPE_AUTH_FAILURES
) != 0)
400 debugaz(_("Authentication failures report not requested in report_type\n"));
402 if(smartfilter
) smartfilter_report();
404 if(DansGuardianConf
[0] != '\0')
405 dansguardian_report();
409 if((ReportType
& REPORT_TYPE_USERS_SITES
) != 0)
412 debugaz(_("User's detailed report not requested in report_type\n"));
417 if(SuccessfulMsg
) debuga(_("Successful report generated on %s\n"),outdirname
);
419 geramail(outdirname
, debug
, outdir
, email
, tmp
);
421 if((strcmp(email
,"stdout") != 0) && SuccessfulMsg
)
422 debuga(_("Successful report generated and sent to %s\n"),email
);
425 if(indexonly
) index_only(outdirname
, debug
);
427 removetmp(outdirname
);
431 static FILE *maketmp(const char *user
, const char *dirname
, int debug
)
434 char wdirname
[MAXLEN
];
436 if((ReportType
& REPORT_TYPE_USERS_SITES
) == 0) return(NULL
);
437 if((ReportType
& REPORT_TYPE_TOPUSERS
) == 0) return(NULL
);
439 if(debug
) debuga(_("Making file: %s/%s\n"),tmp
,user
);
440 if (snprintf(wdirname
,sizeof(wdirname
),"%s/%s.utmp",tmp
,user
)>=sizeof(wdirname
)) {
441 debuga(_("Temporary file name too long: %s/%s.utmp\n"),tmp
,user
);
445 if((fp_ou
=fopen(wdirname
,"w"))==NULL
){
446 debuga(_("(report) Cannot open file %s: %s\n"),wdirname
,strerror(errno
));
454 static void gravatmp(FILE *fp_ou
, const char *oldurl
, long long int nacc
, long long int nbytes
, const char *oldmsg
, long long int nelap
, long long int incache
, long long int oucache
)
457 This complicated printf is due to Microsoft's inability to comply with any standard. Msvcrt is unable
458 to print a long long int unless it is exactly 64-bits long.
460 fprintf(fp_ou
,"%"PRIu64
"\t%"PRIu64
"\t%s\t%s\t%"PRIu64
"\t%"PRIu64
"\t%"PRIu64
"\n",(uint64_t)nacc
,(uint64_t)nbytes
,oldurl
,oldmsg
,(uint64_t)nelap
,(uint64_t)incache
,(uint64_t)oucache
);
465 fputs("</table>\n</div>\n",fp_tt
);
466 fputs("</body>\n</html>\n",fp_tt
);
467 if (fclose(fp_tt
)==EOF
) {
468 debuga(_("Write error in %s: %s\n"),arqtt
,strerror(errno
));
477 static void gravaporuser(const struct userinfostruct
*uinfo
, const char *dirname
, const char *url
, const char *ip
, const char *data
, const char *hora
, long long int tam
, long long int elap
)
480 char wdirname
[MAXLEN
];
482 if((ReportType
& REPORT_TYPE_USERS_SITES
) == 0) return;
484 if (snprintf(wdirname
,sizeof(wdirname
),"%s/%s.ip",tmp
,uinfo
->filename
)>=sizeof(wdirname
)) {
485 debuga(_("Path too long %s/%s.ip\n"),tmp
,uinfo
->filename
);
489 if((fp_ou
=MY_FOPEN(wdirname
,"a"))==NULL
){
490 debuga(_("(report) Cannot open file %s: %s\n"),wdirname
,strerror(errno
));
495 This complicated printf is due to Microsoft's inability to comply with any standard. Msvcrt is unable
496 to print a long long int unless it is exactly 64-bits long.
498 fprintf(fp_ou
,"%s\t%s\t%s\t%s\t%"PRIu64
"\t%"PRIu64
"\n",ip
,url
,data
,hora
,(uint64_t)tam
,(uint64_t)elap
);
500 if (fclose(fp_ou
)==EOF
) {
501 debuga(_("Write error in %s: %s\n"),wdirname
,strerror(errno
));
509 static void gravager(FILE *fp_gen
,const char *filename
, const struct userinfostruct
*uinfo
, 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
)
512 This complicated printf is due to Microsoft's inability to comply with any standard. Msvcrt is unable
513 to print a long long int unless it is exactly 64-bits long.
515 if (fprintf(fp_gen
,"%s\t%"PRIu64
"\t%"PRIu64
"\t%s\t%s\t%s\t%s\t%"PRIu64
"\t%"PRIu64
"\t%"PRIu64
"\n",uinfo
->id
,(uint64_t)nacc
,(uint64_t)nbytes
,url
,ip
,hora
,dia
,(uint64_t)nelap
,(uint64_t)incache
,(uint64_t)oucache
)<0) {
516 debuga(_("Failed to write a line in %s\n"),filename
);
521 globstat
.nbytes
+=nbytes
;
522 globstat
.elap
+=nelap
;
523 globstat
.incache
+=incache
;
524 globstat
.oucache
+=oucache
;
529 Write the total line at the end of the general file.
531 void totalger(FILE *fp_gen
,const char *filename
)
534 This complicated printf is due to Microsoft's inability to comply with any standard. Msvcrt is unable
535 to print a long long int unless it is exactly 64-bits long.
537 if (fprintf(fp_gen
,"TOTAL\t%"PRIu64
"\t%"PRIu64
"\t%"PRIu64
"\t%"PRIu64
"\t%"PRIu64
"\n",(uint64_t)globstat
.nacc
,(uint64_t)globstat
.nbytes
,(uint64_t)globstat
.elap
,(uint64_t)globstat
.incache
,(uint64_t)globstat
.oucache
)<0) {
538 debuga(_("Failed to write the total line in %s\n"),filename
);
543 int ger_read(char *buffer
,struct generalitemstruct
*item
,const char *filename
)
547 long long int number
;
549 if (strncmp(buffer
,"TOTAL\t",6)==0) {
554 if (*buffer
== '-') {
557 } else if (*buffer
== '+') {
561 while (isdigit(*buffer
))
562 number
=(number
* 10) + (*buffer
++)-'0';
564 debuga(_("Invalid total number of accesses in %s\n"),filename
);
568 item
->nacc
=number
*sign
;
571 if (*buffer
== '-') {
574 } else if (*buffer
== '+') {
578 while (isdigit(*buffer
))
579 number
=(number
* 10) + (*buffer
++)-'0';
581 debuga(_("Invalid total size in %s\n"),filename
);
585 item
->nbytes
=number
*sign
;
588 if (*buffer
== '-') {
591 } else if (*buffer
== '+') {
595 while (isdigit(*buffer
))
596 number
=(number
* 10) + (*buffer
++)-'0';
598 debuga(_("Invalid total elapsed time in %s\n"),filename
);
602 item
->nelap
=number
*sign
;
605 if (*buffer
== '-') {
608 } else if (*buffer
== '+') {
612 while (isdigit(*buffer
))
613 number
=(number
* 10) + (*buffer
++)-'0';
615 debuga(_("Invalid total cache hit in %s\n"),filename
);
619 item
->incache
=number
*sign
;
622 if (*buffer
== '-') {
625 } else if (*buffer
== '+') {
629 while (isdigit(*buffer
))
630 number
=(number
* 10) + (*buffer
++)-'0';
632 debuga(_("Invalid total cache miss in %s\n"),filename
);
635 item
->oucache
=number
*sign
;
640 for (i
=0 ; i
<MAX_USER_LEN
-1 && (unsigned char)*buffer
>=' ' ; i
++) buffer
++;
642 debuga(_("User name too long or invalid in %s\n"),filename
);
648 if (*buffer
== '-') {
651 } else if (*buffer
== '+') {
655 while (isdigit(*buffer
))
656 number
=(number
* 10) + (*buffer
++)-'0';
658 debuga(_("Invalid number of accesses in %s\n"),filename
);
662 item
->nacc
=number
*sign
;
665 if (*buffer
== '-') {
668 } else if (*buffer
== '+') {
672 while (isdigit(*buffer
))
673 number
=(number
* 10) + (*buffer
++)-'0';
675 debuga(_("Invalid number of bytes in %s\n"),filename
);
679 item
->nbytes
=number
*sign
;
682 while ((unsigned char)*buffer
>=' ') buffer
++;
684 debuga(_("URL too long or invalid in %s\n"),filename
);
690 for (i
=0 ; i
<MAX_IP_LEN
-1 && (unsigned char)*buffer
>=' ' ; i
++) buffer
++;
692 debuga(_("IP address too long or invalid in %s\n"),filename
);
698 for (i
=0 ; i
<MAX_DATETIME_LEN
-1 && (unsigned char)*buffer
>=' ' ; i
++) buffer
++;
700 debuga(_("Time too long or invalid in %s\n"),filename
);
706 for (i
=0 ; i
<MAX_DATETIME_LEN
-1 && (unsigned char)*buffer
>=' ' ; i
++) buffer
++;
708 debuga(_("Date too long or invalid in %s\n"),filename
);
714 if (*buffer
== '-') {
717 } else if (*buffer
== '+') {
721 while (isdigit(*buffer
))
722 number
=(number
* 10) + (*buffer
++)-'0';
724 debuga(_("Invalid elapsed time in %s\n"),filename
);
728 item
->nelap
=number
*sign
;
731 if (*buffer
== '-') {
734 } else if (*buffer
== '+') {
738 while (isdigit(*buffer
))
739 number
=(number
* 10) + (*buffer
++)-'0';
741 debuga(_("Invalid cache hit size in %s\n"),filename
);
745 item
->incache
=number
*sign
;
748 if (*buffer
== '-') {
751 } else if (*buffer
== '+') {
755 while (isdigit(*buffer
))
756 number
=(number
* 10) + (*buffer
++)-'0';
758 debuga(_("Invalid cache miss size in %s\n"),filename
);
761 item
->oucache
=number
*sign
;
766 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
)
769 char wdirname
[MAXLEN
];
771 if (snprintf(wdirname
,sizeof(wdirname
),"%s/smartfilter.int_unsort",dirname
)>=sizeof(wdirname
)) {
772 debuga(_("File name too long for %s/smartfilter.int_unsort\n"),dirname
);
776 if((fp_ou
=MY_FOPEN(wdirname
,"a"))==NULL
){
777 debuga(_("(report) Cannot open file %s: %s\n"),wdirname
,strerror(errno
));
781 fprintf(fp_ou
,"%s\t%s\t%s\t%s\t%s\t%s\n",user
,data
,hora
,ip
,url
,smart
);
782 fputs("</body>\n</html>\n",fp_tt
);
784 if (fclose(fp_ou
)==EOF
) {
785 debuga(_("Write error in %s: %s\n"),wdirname
,strerror(errno
));