char hfile[MAXLEN];
char idate[MAXLEN], fdate[MAXLEN];
char tmp2[MAXLEN];
+ char day[4],month[5],year[5], wdate[20];
int agentot=0, agentot2=0, agentdif=0, cont=0, nagent;
unsigned long totregsl=0;
int cstatus;
- char ftime[128];
- struct getwordstruct gwarea;
+ int ndate;
+ double perc;
+ struct getwordstruct gwarea, gwarea1;
ip[0]='\0';
data[0]='\0';
printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",UserAgentLog);
exit(1);
}
+ getword_start(&gwarea1,data);
+ if (getword(day,sizeof(day),&gwarea1,'/')<0 || getword(month,sizeof(month),&gwarea1,'/')<0 ||
+ getword(year,sizeof(year),&gwarea1,':')<0) {
+ printf("SARG: Maybe you have a broken date in your %s file.\n",UserAgentLog);
+ exit(1);
+ }
+ buildymd(day,month,year,wdate);
+ ndate=atoi(wdate);
+ if (ndate<dfrom || ndate>duntil) continue;
if(totregsl == 1)
strcpy(idate,data);
+ strcpy(fdate,data);
if (getword_skip(MAXLEN,&gwarea,'"')<0 || getword(agent,sizeof(agent),&gwarea,'"')<0) {
- printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",UserAgentLog);
+ printf("SARG: Maybe you have a broken useragent entry in your %s file.\n",UserAgentLog);
exit(1);
}
strcpy(warea,agent);
user[0]='\0';
}
- strcpy(fdate,data);
-
if(debug) {
debuga(" %s: %ld",text[10],totregsl);
}
fprintf(fp_ht, "<!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);
css(fp_ht);
fputs("</head>\n",fp_ht);
- //if(FontFace[0] != '\0') fprintf(fp_ht,"<font face=\"%s\">\n",FontFace);
- fprintf(fp_ht,"<body bgcolor=\"%s\" text=\"%s\" background=\"%s\">\n",BgColor,TxColor,BgImage);
+ fputs("<body class=\"body\">\n",fp_ht);
write_logo_image(fp_ht);
if(IndexTree == INDEX_TREE_DATE)
else
show_sarg(fp_ht,"..");
fputs("<div align=\"center\"><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ht);
- fprintf(fp_ht,"<tr><th align=\"center\" colspan=\"2\"><b><font color=\"%s\" size=\"+1\">%s</font></b></th></tr>\n",TiColor,text[105]);
-
- fputs("<tr><td></td></tr><tr><td></td></tr>",fp_ht);
+ fprintf(fp_ht,"<tr><th class=\"title\">%s</th></tr>\n",text[105]);
+ fprintf(fp_ht,"<tr><td class=\"header3\">%s: %s - %s</td></tr>\n",text[89],idate,fdate);
fputs("</table></div>\n",fp_ht);
fputs("<div align=\"center\"><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ht);
- fprintf(fp_ht,"<tr><td align=\"right\" bgcolor=\"%s\">%s:<td align=\"left\" bgcolor=\"%s\">%s - %s</td></td></tr>\n",HeaderBgColor,text[89],TxBgColor,idate,fdate);
-
fputs("</table></div>\n",fp_ht);
fputs("<div align=\"center\"><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ht);
- fputs("<tr><td></td><td></td></tr>",fp_ht);
+ fputs("<tr><td> </td><td> </td></tr>",fp_ht);
- fprintf(fp_ou,"<tr><th align=\"left\" bgcolor=\"%s\"><font color=\"%s\">%s</font></th><th bgcolor=\"%s\" align=\"left\"><font color=\"%s\">%s</font></th></tr>\n",HeaderBgColor,HeaderColor,text[98],HeaderBgColor,HeaderColor,text[106]);
+ fprintf(fp_ou,"<tr><th class=\"header\">%s</th><th class=\"header\">%s</th></tr>\n",text[98],text[106]);
while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
getword_start(&gwarea,buf);
}
if(strcmp(user,user_old) != 0) {
- fprintf(fp_ht,"<tr><td align=\"left\" bgcolor=\"%s\">%s</td><td align=\"left\" bgcolor=\"%s\">%s</td></tr>\n",TxBgColor,user,TxBgColor,agent);
+ fprintf(fp_ht,"<tr><td class=\"data2\">%s</td><td class=\"data2\">%s</td></tr>\n",user,agent);
strcpy(user_old,user);
strcpy(agent_old,agent);
} else {
if(strcmp(agent,agent_old) != 0) {
- fprintf(fp_ht,"<tr><td></td><td align=\"left\" bgcolor=\"%s\">%s</td></tr>\n",TxBgColor,agent);
+ fprintf(fp_ht,"<tr><td></td><td class=\"data2\">%s</td></tr>\n",agent);
strcpy(agent_old,agent);
}
}
exit(1);
}
- fputs("<br><br>\n",fp_ht);
+ fputs("<br/><br/>\n",fp_ht);
fputs("<div align=\"center\"><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ht);
- fprintf(fp_ht,"<tr><th align=\"left\" bgcolor=\"%s\"><font color=\"%s\">%s</font></th><th bgcolor=\"%s\" align=\"left\"><font color=\"%s\">%s</font></th><th align=\"center\" bgcolor=\"%s\"><font color=\"%s\">%%</font></th></tr>\n",HeaderBgColor,HeaderColor,text[106],HeaderBgColor,HeaderColor,text[107],HeaderBgColor,HeaderColor);
+ fprintf(fp_ht,"<tr><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header3\">%%</th></tr>\n",text[106],text[107]);
perc=0.;
while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
exit(1);
}
nagent=atoi(tagent);
- if(agentot2>0) {
- perc=nagent * 100;
- perc=perc / agentot2;
- }
+ perc=(agentot2>0) ? nagent * 100. / agentot2 : 0.;
- fprintf(fp_ht,"<tr><td align=\"left\" bgcolor=\"%s\">%s</td><td align=\"right\" bgcolor=\"%s\">%d</td><td align=\"right\" bgcolor=\"%s\">%3.2f</td></tr>\n",TxBgColor,gwarea.current,TxBgColor,nagent,TxBgColor,perc);
+ fprintf(fp_ht,"<tr><td class=\"data2\">%s</td><td class=\"data\">%d</td><td class=\"data\">%3.2lf</td></tr>\n",gwarea.current,nagent,perc);
}
fputs("</table></html>\n",fp_ht);
- if(ShowSargInfo) {
- zdate(ftime, sizeof(ftime), DateFormat);
- fprintf(fp_ht,"<br><br><div align=\"center\"><font size=\"-2\">%s <a href=\"%s\">%s-%s</a> %s %s</font></div>\n",text[108],URL,PGM,VERSION,text[109],ftime);
- }
+ show_info(fp_ht);
fputs("</table>\n</body>\n</html>\n",fp_ht);
fclose(fp_in);