From bcd02c78189aecc381617d85be18f2829f62ae42 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 11 May 2016 16:23:14 -0400 Subject: Fixed comment submission --- ws2a/bugcomment.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'ws2a/bugcomment.c') 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("

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("

name:%s

userid:%s

comment:%s

captcha:%s

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"); -- cgit v1.2.3-70-g09d2