diff options
| author | Alexander Pickering <Apickx@cogarr.org> | 2016-05-10 13:58:44 -0400 |
|---|---|---|
| committer | Alexander Pickering <Apickx@cogarr.org> | 2016-05-10 13:58:44 -0400 |
| commit | bbcdc233737b21b2ee3dd4a0a548ea2ed9949a7e (patch) | |
| tree | ba6c176109e6ba49ef4ecc539b204f4ffc43c9e2 | |
| parent | 0606b73a766fa3074c1ce5d3a93a93ef34b16e30 (diff) | |
| parent | 927c844f3d87fa6d6db1ac2ad93813ed06277939 (diff) | |
| download | webpage-bbcdc233737b21b2ee3dd4a0a548ea2ed9949a7e.tar.gz webpage-bbcdc233737b21b2ee3dd4a0a548ea2ed9949a7e.tar.bz2 webpage-bbcdc233737b21b2ee3dd4a0a548ea2ed9949a7e.zip | |
Merge branch 'development'
| -rw-r--r-- | ws2a/bugview.js | 9 | ||||
| -rw-r--r-- | ws2a/gencaptcha.c | 18 |
2 files changed, 11 insertions, 16 deletions
diff --git a/ws2a/bugview.js b/ws2a/bugview.js index 0f1d5c6..60ffb11 100644 --- a/ws2a/bugview.js +++ b/ws2a/bugview.js @@ -71,5 +71,14 @@ function loadLastBugs() { var bugnum = query["id"]; xhttp.open("GET", "/cgi-bin/showbug.cgi?id="+bugnum, true); xhttp.send(); + var captcha = new XMLHttpRequest(); + captcha.onreadystatechange = function() { + if (captcha.readyState == 4 && captcha.status == 200) { + var imgname = xhttp.response; + document.getElementById("captchaimg").innerHTML = "<img src=\"./captchas/" + imgname + ".png"; + } + }; + captcha.open("GET","/cgi-bin/gencaptcha.cgi",true); + captcha.send(); } window.onload = loadLastBugs diff --git a/ws2a/gencaptcha.c b/ws2a/gencaptcha.c index 6079d35..964e730 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:image/png;charset=iso-8859-1",13,10); + "Content-Type:text/html;charset=iso-8859-1",13,10); srand(time(NULL)); char randwords[LONGADJ+LONGNOU+1]; @@ -67,19 +67,5 @@ int main(){ sprintf(command,"convert \"../ws2a/captchas/%s.png\" -virtual-pixel White -distort Arc %d \"../ws2a/captchas/%s.png\"",randwords,arcdis,randwords); system(command); - 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); - } + printf(randwords); } |
