diff options
Diffstat (limited to 'ws2a/bugcomment.c')
| -rw-r--r-- | ws2a/bugcomment.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/ws2a/bugcomment.c b/ws2a/bugcomment.c index fdee046..6bd70f2 100644 --- a/ws2a/bugcomment.c +++ b/ws2a/bugcomment.c @@ -79,12 +79,15 @@ int main(){ printf("%s%c%c\n","Content-Type:text/html;charset=iso-8859-1",13,10); printf("<p>data:%s",data); + /* char name[15]; char userid[20]; char comment[2048]; char captcha[25]; char bugid[5]; + */ + /* char* iname = strtok(data,"&"); char* iuserid = strtok(NULL,"&"); char* icomment = strtok(NULL,"&"); @@ -96,6 +99,12 @@ int main(){ sscanf(icomment,"comment=%s",comment); sscanf(icaptcha,"captcha=%s",captcha); sscanf(ibugid,"bugid=%s",bugid); + */ + char* name = "Apickx"; + char* userid = "ThestID"; + char* comment = "This+Is+My+Comment"; + char* captcha = "teeny-tiny+currency"; + char* bugid = "1"; printf("<p>name:%s<p>userid:%s<p>comment:%s<p>captcha:%s<p>bugid:%s",name,userid,comment,captcha,bugid); @@ -103,22 +112,24 @@ int main(){ char captchapath[100]; char* captchadecoded = replaceHTML(captcha); sprintf(captchapath,"../ws2a/captchas/%s.txt",captchadecoded); - free(captchadecoded); + FILE* captchafile = fopen(captchapath,"r"); if(captchafile == NULL){ printf("Captcha incorrect"); return; } + //Hash of "teeny-tiny currency" is 2053680550 unsigned long inputhash = hash(captchadecoded); + free(captchadecoded); unsigned long filehash = 0; fscanf(captchafile,"%lu",&filehash); if(filehash != inputhash){ printf("Captcha incorrect"); - printf("input:%s correct:%s",inputhash,filehash); + printf("input:%lu correct:%lu",inputhash,filehash); return; } printf("Captcha correct, deleteing..."); - /* + char command[100]; sprintf(command,"rm \"%s.txt\"",captchapath); system(command); @@ -139,7 +150,6 @@ int main(){ free(dname); free(duid); free(dcomment); - */ /* FILE* lastfilenum; lastfilenum = fopen("../ws2a/bugs/lastbug","r"); |
