diff options
| author | Alexander Pickering <Apickx@cogarr.org> | 2016-05-10 17:06:35 -0400 |
|---|---|---|
| committer | Alexander Pickering <Apickx@cogarr.org> | 2016-05-10 17:06:35 -0400 |
| commit | c92ea6b0b20554d2e01151cedbfbe2067aa40613 (patch) | |
| tree | d6ac8af5085c355782d32602802687e1388cbe32 /ws2a/gencaptcha.c | |
| parent | c32453b399c32f7b6cdc782fc27fb4715bd624d9 (diff) | |
| parent | cc7e38d81b190ea6160cd5dee544ab2f0bfb8b51 (diff) | |
| download | webpage-c92ea6b0b20554d2e01151cedbfbe2067aa40613.tar.gz webpage-c92ea6b0b20554d2e01151cedbfbe2067aa40613.tar.bz2 webpage-c92ea6b0b20554d2e01151cedbfbe2067aa40613.zip | |
Merge branch 'development'
Diffstat (limited to 'ws2a/gencaptcha.c')
| -rw-r--r-- | ws2a/gencaptcha.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ws2a/gencaptcha.c b/ws2a/gencaptcha.c index cdb669d..de5729c 100644 --- a/ws2a/gencaptcha.c +++ b/ws2a/gencaptcha.c @@ -77,14 +77,15 @@ int main(){ 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); - printf("%s%c%c\n","Content-Type:text/html;charset=iso-8859-1",13,10); - printf("%lu",rhash); - /* FILE* imgfile; + FILE* tofile; char filepath[100]; - sprintf(filepath,"../ws2a/captchas/%lu.png",hash(randwords)); + 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; @@ -101,13 +102,17 @@ int main(){ 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){ - printf("%c",buffer[i]); + 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); /* char c; while((c = fgetc(imgfile)) && !feof(imgfile)){ |
