summaryrefslogtreecommitdiff
path: root/ws2a/gencaptcha.c
diff options
context:
space:
mode:
Diffstat (limited to 'ws2a/gencaptcha.c')
-rw-r--r--ws2a/gencaptcha.c15
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)){