diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-10 18:49:02 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-10 18:49:02 -0400 |
| commit | ecd2cf4f930853c13c23f5a35bb1a2610bcb54c9 (patch) | |
| tree | f6122fe8a25c8a2c7dd319d8da2c326c66a4a697 /ws2a/bugcomment.c | |
| parent | 2eaa3969ef07cd8c7036c22c05072bdba2001887 (diff) | |
| download | webpage-ecd2cf4f930853c13c23f5a35bb1a2610bcb54c9.tar.gz webpage-ecd2cf4f930853c13c23f5a35bb1a2610bcb54c9.tar.bz2 webpage-ecd2cf4f930853c13c23f5a35bb1a2610bcb54c9.zip | |
More work on submitting messages to bug view
Diffstat (limited to 'ws2a/bugcomment.c')
| -rw-r--r-- | ws2a/bugcomment.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/ws2a/bugcomment.c b/ws2a/bugcomment.c new file mode 100644 index 0000000..10df1d1 --- /dev/null +++ b/ws2a/bugcomment.c @@ -0,0 +1,53 @@ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <stdint.h> + +int main(){ + char* data = getenv("QUERY_STRING"); + //char data[20] = "?id=1"; + char* hardip = getenv("REMOTE_ADDR"); + 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; + if(fscanf(lastfilenum,"%lld",&last) < 1){ + printf("Error finding file id"); + return 1; + } + fclose(lastfilenum); + long long thisid = 0; + sscanf(data,"id=%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)){ + char c = fgetc(bugfile); + if(feof(bugfile)){ + break; + }else{ + putchar(c); + } + } + fclose(bugfile); + */ + return 0; +} |
