diff options
Diffstat (limited to 'ws2a/bugsdata.c')
| -rw-r--r-- | ws2a/bugsdata.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/ws2a/bugsdata.c b/ws2a/bugsdata.c index 4ba3718..498eaf4 100644 --- a/ws2a/bugsdata.c +++ b/ws2a/bugsdata.c @@ -2,10 +2,33 @@ #include <string.h> #include <stdlib.h> #include <stdint.h> +#include "common.c" int main(){ - char* data = getenv("QUERY_STRING"); - char* hardip = getenv("REMOTE_ADDR"); + FILE* lastfilenum; + lastfilenum = fopen("../ws2a/bugs/lastbug","r") + if(lastfilenum == NULL){ + printf("Error reteriveing bugs, contact the admin!") + } + long long last = 0; + fscanf(lastfilenum,"%u",&last); + long long end = last-20; + while(last > end && last > 0){ + char filestring[64]; + strcat(filestring,"../ws2a/bugs/"); + strcat(filestring,itoa(last)); + FILE* thisbug; + thisbug = fopen(filestring,"r"); + if(thisbug == NULL){ + printf("Error opening bug:%d\n",last); + continue; + } + while(!feof(thisbug)){ + putc(fgetc(thisbug)); + } + printf("<br/>"); + last--; + } printf("%s%c%c\n", "Content-Type:text/html;charset=iso-8859-1",13,10); printf("Data:%s",data); |
