From a6e302ff8433108ff59ef2035fbdf6b3de9e2dec Mon Sep 17 00:00:00 2001 From: thisgun Date: Tue, 26 Jul 2022 11:35:33 +0900 Subject: [PATCH] =?UTF-8?q?KCAPTCHA=20php5.3=20=EB=B2=84=EC=A0=84=20?= =?UTF-8?q?=EC=9D=B4=ED=95=98=EC=97=90=EC=84=9C=20=EB=82=98=EB=8A=94=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/kcaptcha/kcaptcha.lib.php | 2 ++ plugin/kcaptcha/kcaptcha_image.php | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugin/kcaptcha/kcaptcha.lib.php b/plugin/kcaptcha/kcaptcha.lib.php index 388395555..92707012f 100644 --- a/plugin/kcaptcha/kcaptcha.lib.php +++ b/plugin/kcaptcha/kcaptcha.lib.php @@ -18,6 +18,8 @@ class KCAPTCHA{ + private $keystring; + // generates keystring and image function image(){ require(dirname(__FILE__).'/kcaptcha_config.php'); diff --git a/plugin/kcaptcha/kcaptcha_image.php b/plugin/kcaptcha/kcaptcha_image.php index fc74c95a4..0fa408f24 100644 --- a/plugin/kcaptcha/kcaptcha_image.php +++ b/plugin/kcaptcha/kcaptcha_image.php @@ -4,10 +4,13 @@ include_once('captcha.lib.php'); $captcha = new KCAPTCHA(); $ss_captcha_key = get_session("ss_captcha_key"); +$ss_captcha_key_decrypt = ''; if( $ss_captcha_key && !preg_match('/^[0-9]/', $ss_captcha_key) && function_exists('get_string_decrypt') ){ $ip = md5(sha1($_SERVER['REMOTE_ADDR'])); - $ss_captcha_key = str_replace($ip, '', get_string_decrypt($ss_captcha_key)); + $ss_captcha_key_decrypt = str_replace($ip, '', get_string_decrypt($ss_captcha_key)); } -$captcha->setKeyString($ss_captcha_key); +# php 5.2 또는 5.3 버전에서 포인터처럼 해당 세션값이 변경되는 버그가 있어서 아래와 같이 조치함 +if(! $ss_captcha_key_decrypt) $ss_captcha_key_decrypt = $ss_captcha_key; +$captcha->setKeyString($ss_captcha_key_decrypt); $captcha->getKeyString(); $captcha->image(); \ No newline at end of file