- time_t tt;
- struct tm *t;
- char dat[128];
- char tbuf[128];
- char typ[128];
- char warea[MAXLEN];
- char user[MAX_USER_LEN];
- char ip[25];
- char *url;
- struct getwordstruct gwarea;
-
- getword_start(&gwarea,rec);
- if (getword(dat,sizeof(dat),&gwarea,' ')<0) {
- debuga(_("The time stamp at column 1 is too long\n"));
- return(-1);
- }
- if (getword(warea,sizeof(warea),&gwarea,' ')<0) {
- debuga(_("The connection duration at column 2 is too long\n"));
- return(-1);
- }
- while(strcmp(warea,"") == 0 && gwarea.current[0] != '\0')
- if (getword(warea,sizeof(warea),&gwarea,' ')<0) {
- return(-1);
- }
- if (getword(ip,sizeof(ip),&gwarea,' ')<0) {
- debuga(_("The IP address at column 3 is too long\n"));
- return(-1);
- }
- if (getword_skip(MAXLEN,&gwarea,' ')<0) {
- debuga(_("The status at column 4 is too long\n"));
- return(-1);
- }
- if (getword_skip(MAXLEN,&gwarea,' ')<0) {
- debuga(_("The size at column 5 is too long\n"));
- return(-1);
- }
- if (getword(typ,sizeof(typ),&gwarea,' ')<0) {
- debuga(_("The action at column 6 is too long\n"));
- return(-1);
- }
- if(strncmp(typ,"CONNECT",7) == 0) {
- if (getword_ptr(rec,&url,&gwarea,' ')<0) {
- debuga(_("The URL at column 7 is too long\n"));
- return(-1);
- }
- if (getword(user,sizeof(user),&gwarea,' ')<0) {
- debuga(_("The user ID at column 8 is too long\n"));
- return(-1);
- }
- }else {
- if (getword_skip(MAXLEN,&gwarea,'/')<0) {
- debuga(_("The URL at column 7 is too long\n"));
- return(-1);
- }
- if (getword_skip(MAXLEN,&gwarea,'/')<0) {
- debuga(_("The URL at column 7 is too long\n"));
- return(-1);
- }
- if (getword_ptr(rec,&url,&gwarea,'/')<0) {
- debuga(_("The URL at column 7 is too long\n"));
- return(-1);
- }
- if (getword_skip(MAXLEN,&gwarea,' ')<0) {
- debuga(_("The data at column 8 is too long\n"));
- return(-1);
- }
- if (getword(user,sizeof(user),&gwarea,' ')<0) {
- debuga(_("The user at column 9 is too long\n"));
- return(-1);
- }
- }
-
- if(strncmp(user,"-",1) == 0 && RealtimeUnauthRec==REALTIME_UNAUTH_REC_IGNORE)
- return(0);
-
- tt=atoi(dat);
- t=localtime(&tt);
- if(strncmp(DateFormat,"u",1) == 0)
- strftime(tbuf, sizeof(tbuf), "%Y-%m-%d\t%H:%M", t);
- else if(strncmp(DateFormat,"e",1) == 0)
- strftime(tbuf, sizeof(tbuf), "%d-%m-%Y\t%H:%M", t);
-
- fprintf(ftmp,"%s\t%s\t%s\t%s\t%s\n",tbuf,ip,user,url,typ);
- return(0);
+ puts("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"");
+ puts(" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
+ puts("<html>\n");
+ puts("<head>\n");
+ if(realtime_refresh)
+ printf(" <meta http-equiv=refresh content=\"%d\" url=\"sarg-php/sarg-realtime.php\"; charset=\"%s\">\n",realtime_refresh,CharSet);
+ else
+ printf(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+ css(stdout);
+ puts("</head>\n");
+ printf("<body style=\"font-family:%s;font-size:%s;background-color:%s;background-image:url(%s)\">\n",FontFace,TitleFontSize,BgColor,BgImage);
+ puts("<div align=\"center\"><table cellpadding=\"1\" cellspacing=\"1\">\n");
+ printf("<tr><th class=\"title_l\" colspan=\"10\">SARG %s</th></tr>\n",_("Realtime"));
+ printf("<tr><th class=\"text\" colspan=\"10\">%s: %d s</th></tr>\n",_("Auto refresh"),realtime_refresh);
+ printf("<tr><th class=\"header_c\">%s</th><th class=\"header_c\">%s</th><th class=\"header_c\">%s</th><th class=\"header_c\">%s</th><th class=\"header_l\">%s</th></tr>\n",_("DATE/TIME"),_("IP/NAME"),_("USERID"),_("TYPE"),_("ACCESSED SITE"));