From 50405a74a19906ee0e9a44f9a71cdfb8c94c0e5c Mon Sep 17 00:00:00 2001 From: Max Kovpak Date: Tue, 25 Aug 2015 16:57:49 +0300 Subject: [PATCH 1/2] Make it more unique If you have 2 forms on one page time will be not unique --- Generator/CaptchaGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Generator/CaptchaGenerator.php b/Generator/CaptchaGenerator.php index 0d653a7..07ba063 100644 --- a/Generator/CaptchaGenerator.php +++ b/Generator/CaptchaGenerator.php @@ -77,7 +77,7 @@ class CaptchaGenerator // Returns the image generation URL if ($options['as_url']) { return $this->router->generate('gregwar_captcha.generate_captcha', - array('key' => $options['session_key'], 'n' => time())); + array('key' => $options['session_key'], 'n' => md5(microtime(true).rand(0, 9)))); } return 'data:image/jpeg;base64,' . base64_encode($this->generate($options)); From c844cbcdbc34e43e3614bbf963ed953e626acc88 Mon Sep 17 00:00:00 2001 From: Max Kovpak Date: Tue, 25 Aug 2015 17:05:28 +0300 Subject: [PATCH 2/2] Update CaptchaGenerator.php --- Generator/CaptchaGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Generator/CaptchaGenerator.php b/Generator/CaptchaGenerator.php index 07ba063..58ff58a 100644 --- a/Generator/CaptchaGenerator.php +++ b/Generator/CaptchaGenerator.php @@ -77,7 +77,7 @@ class CaptchaGenerator // Returns the image generation URL if ($options['as_url']) { return $this->router->generate('gregwar_captcha.generate_captcha', - array('key' => $options['session_key'], 'n' => md5(microtime(true).rand(0, 9)))); + array('key' => $options['session_key'], 'n' => md5(microtime(true).mt_rand()))); } return 'data:image/jpeg;base64,' . base64_encode($this->generate($options));