From 5ddc56a646721ea20bf83134ad1efe9b4a93cfc9 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 9 May 2016 14:34:09 -0400 Subject: More work on bug reporter --- ws2a/bugsdata.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'ws2a/bugsdata.c') 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 #include #include +#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("
"); + last--; + } printf("%s%c%c\n", "Content-Type:text/html;charset=iso-8859-1",13,10); printf("Data:%s",data); -- cgit v1.2.3-70-g09d2