diff options
| -rw-r--r-- | ws2a/showbug.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ws2a/showbug.c b/ws2a/showbug.c index b8c46e2..aa5cf7d 100644 --- a/ws2a/showbug.c +++ b/ws2a/showbug.c @@ -10,4 +10,36 @@ int main(){ printf("%s%c%c\n", "Content-Type:text/html;charset=iso-8859-1",13,10); printf("Data:%s",data); + FILE* lastfilenum; + lastfilenum = fopen("../ws2a/bugs/lastbug","r"); + if(lastfilenum == NULL){ + printf("Error reteriveing bugs, contact the admin!"); + return 1; + } + long long last = 0; + fscanf(lastfilenum,"%lld",&last); + fclose(lastfilenum); + long long thisid = 0; + sscanf(data,"id=%lld",&thisid); + printf("Looking for bugid:%lld",thisid); + if(thisid > last){ + printf("Invalid!"); + return 1; + } + + char filestring[64] = "../ws2a/bugs/"; + char filename[10]; + sprintf(filename,"%lld",thisid); + strcat(filestring,filename); + FILE* bugfile; + bugfile = fopen(filestring,"r"); + if(bugfile == NULL){ + printf("Unable to open bug file!"); + return 1; + } + while(!feof(bugfile)){ + printf("File:"); + putchar(fgetc(bugfile)); + } + fclose(bugfile); } |
