diff options
| author | Alexander Pickering <Apickx@cogarr.org> | 2016-05-10 14:02:17 -0400 |
|---|---|---|
| committer | Alexander Pickering <Apickx@cogarr.org> | 2016-05-10 14:02:17 -0400 |
| commit | 210ecc4a8d79c7f069efbd132d3a97137134bda0 (patch) | |
| tree | 6a18539336e04c592f5d2eba5c8f4fcf378dcc70 /ws2a/gencaptcha.c | |
| parent | bbcdc233737b21b2ee3dd4a0a548ea2ed9949a7e (diff) | |
| parent | 335ecf09f90357dce2bd641296bec0127fd50758 (diff) | |
| download | webpage-210ecc4a8d79c7f069efbd132d3a97137134bda0.tar.gz webpage-210ecc4a8d79c7f069efbd132d3a97137134bda0.tar.bz2 webpage-210ecc4a8d79c7f069efbd132d3a97137134bda0.zip | |
Merge branch 'development'
Diffstat (limited to 'ws2a/gencaptcha.c')
| -rw-r--r-- | ws2a/gencaptcha.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/ws2a/gencaptcha.c b/ws2a/gencaptcha.c index 964e730..d0f9e50 100644 --- a/ws2a/gencaptcha.c +++ b/ws2a/gencaptcha.c @@ -50,7 +50,7 @@ void createRandomWords(char* buf){ int main(){ printf("%s%c%c\n", - "Content-Type:text/html;charset=iso-8859-1",13,10); + "Content-Type:image/png",13,10); srand(time(NULL)); char randwords[LONGADJ+LONGNOU+1]; @@ -67,5 +67,19 @@ int main(){ sprintf(command,"convert \"../ws2a/captchas/%s.png\" -virtual-pixel White -distort Arc %d \"../ws2a/captchas/%s.png\"",randwords,arcdis,randwords); system(command); - printf(randwords); + FILE* imgfile; + char filepath[100]; + sprintf(filepath,"../ws2a/captchas/%s.png",randwords); + imgfile = fopen(filepath,"r"); + if(imgfile == NULL){ + printf("Unable to open file!"); + return 1; + } + while(!feof(imgfile)){ + char c = fgetc(imgfile); + if(feof(imgfile)){ + return 0; + } + putchar(c); + } } |
