#include #include #include #include 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); char name[15]; char userid[20]; char comment[2048]; char captcha[25]; long long bugid = 0; char* iname = strtok(data,"&"); char* iuserid = strtok(NULL,"&"); char* icomment = strtok(NULL,"&"); char* icaptcha = strtok(NULL,"&"); char* ibugid = strtok(NULL,"&"); sscanf(iname,"name=%s",name); sscanf(iuserid,"id=%s",userid); sscanf(icomment,"comment=%s",comment); sscanf(icaptcha,"captcha=%s",captcha); sscanf(ibugid,"bugid=%lld",&bugid); printf("

name:%s

userid:%s

comment:%s

captcha:%s

bugid:%s",name,userid,comment,captcha,bugid); /* 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; }