X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ffreenet%2Fcaptcha%2Fsimplecaptcha.cpp;h=512774e301562ebc1df32b77a2f7eebde3869891;hb=dec33c63afafabf83c3039e916725cac6faef9b3;hp=7539f80e15973aebb1ce4b9e6aeaebb5b0d48ff0;hpb=44f964d9b2b2d55a5b5672e9297717bd25fa8ee2;p=fms.git diff --git a/src/freenet/captcha/simplecaptcha.cpp b/src/freenet/captcha/simplecaptcha.cpp index 7539f80..512774e 100644 --- a/src/freenet/captcha/simplecaptcha.cpp +++ b/src/freenet/captcha/simplecaptcha.cpp @@ -3,6 +3,8 @@ #include "../../../include/freenet/captcha/easybmp/EasyBMP_Font.h" #include "../../../include/freenet/captcha/easybmp/EasyBMP_Geometry.h" +#include + #include #ifdef XMEM @@ -16,8 +18,9 @@ void SimpleCaptcha::Generate() int bmpheight=50; RGBApixel lettercols[5]; std::string puzzlestring; - std::string tempfilename=GenerateRandomString(10); - tempfilename+=".bmp"; + std::string tempfilename=""; + + tempfilename=Poco::TemporaryFile::tempName(); puzzlestring=GenerateRandomString(5); m_solution.clear(); @@ -53,16 +56,17 @@ void SimpleCaptcha::Generate() double endangle=(double)(rand()%360)*(3.14159/180); pixel.Red=100+(rand()%150); pixel.Green=100+(rand()%150); + pixel.Blue=100+(rand()%150); DrawArc(bmp,x1,y1,radius,startangle,endangle,pixel); } for(int i=0; i<5; i++) { // keep the colors dark - lettercols[i].Red=(rand()%200); - lettercols[i].Green=(rand()%200); - lettercols[i].Blue=(rand()%200); - // draw a line with the letter col + lettercols[i].Red=(rand()%150); + lettercols[i].Green=(rand()%150); + lettercols[i].Blue=(rand()%150); + // draw a line with the letter color DrawAALine(bmp,rand()%bmpwidth,rand()%bmpheight,rand()%bmpwidth,rand()%bmpheight,lettercols[i]); }