diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-10 18:19:36 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-10 18:19:36 -0400 |
| commit | 2eaa3969ef07cd8c7036c22c05072bdba2001887 (patch) | |
| tree | bcf91a689619d8c9eceea611595565dfcfe4a7bf | |
| parent | 0aa4b697d1001b29716af77ab494b2fd9db6e822 (diff) | |
| download | webpage-2eaa3969ef07cd8c7036c22c05072bdba2001887.tar.gz webpage-2eaa3969ef07cd8c7036c22c05072bdba2001887.tar.bz2 webpage-2eaa3969ef07cd8c7036c22c05072bdba2001887.zip | |
Modified captcha generation again
| -rw-r--r-- | ws2a/gencaptcha.c | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/ws2a/gencaptcha.c b/ws2a/gencaptcha.c index de5729c..c21e6ef 100644 --- a/ws2a/gencaptcha.c +++ b/ws2a/gencaptcha.c @@ -76,41 +76,7 @@ int main(){ system(command); sprintf(command,"convert \"/home/git/wswebpage/ws2a/captchas/%lu.png\" -virtual-pixel White -distort Arc %d \"/home/git/wswebpage/ws2a/captchas/%lu.png\"",rhash,arcdis,rhash); system(command); - - FILE* imgfile; - FILE* tofile; - char filepath[100]; - char tofilepath[100]; - sprintf(filepath,"../ws2a/captchas/%lu.png",rhash); - sprintf(tofilepath,"/home/git/wswebpage/ws2a/captchas/%lu.png",rhash); - //printf("Filepath:%s",filepath); - imgfile = fopen(filepath,"rb"); - tofile = fopen(tofilepath,"wb"); - if(imgfile == NULL){ - printf("Unable to open file!"); - return 1; - } - fseek(imgfile,0,SEEK_END); - unsigned long filelen = ftell(imgfile); - //printf("File length:%lu",filelen); - fseek(imgfile,0,SEEK_SET); - //fwrite(imgfile,1,filelen,stdout); - - char* buffer = malloc(filelen+1); - if(buffer == NULL){ - printf("Memory error!"); - return 1; - } - fread(buffer, filelen, 1, imgfile); - fclose(imgfile); - //printf("%s%c%c\n","Content-Type:image/png",13,10); - int i = 0; - while(i < filelen){ - fprintf(tofile,"%c",buffer[i]); - i++; - } - free(buffer); - fclose(tofile); + printf("%s%c%c\n","Content-Type:text/html;charset=iso-8859-1",13,10); printf("%lu",rhash); /* |
