From 7feb58aeaba4b45a170e48cf87cdf3e6570abeed Mon Sep 17 00:00:00 2001 From: gnuboard Date: Tue, 8 Jan 2013 09:04:13 +0900 Subject: [PATCH] =?UTF-8?q?captcha=20=EC=A0=81=EC=9A=A9=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bbs/register_form.php | 2 +- bbs/register_form_update.php | 4 +- bbs/register_result.php | 8 ++-- extend/captcha.extend.php | 8 ++++ extend/tcaptcha.extend.php | 8 ---- js/wrest.js | 14 +++---- lib/common.lib.php | 4 +- plugin/captcha/captcha.js | 58 ++++---------------------- plugin/captcha/captcha.lib.php | 4 -- skin/member/neo/register_form.skin.php | 20 ++++----- 10 files changed, 41 insertions(+), 89 deletions(-) create mode 100644 extend/captcha.extend.php delete mode 100644 extend/tcaptcha.extend.php diff --git a/bbs/register_form.php b/bbs/register_form.php index 57b5eeb53..4a3d6a404 100644 --- a/bbs/register_form.php +++ b/bbs/register_form.php @@ -1,6 +1,6 @@ lib) include_once($captcha->lib); // 불법접근을 막도록 토큰생성 $token = md5(uniqid(rand(), true)); diff --git a/bbs/register_form_update.php b/bbs/register_form_update.php index 33c2d11d5..d91812683 100644 --- a/bbs/register_form_update.php +++ b/bbs/register_form_update.php @@ -15,8 +15,8 @@ if ($w == 'u' && $is_admin == 'super') { alert('데모 화면에서는 하실(보실) 수 없는 작업입니다.'); } -if (!chk_tcaptcha("user_answer")) { - alert("정상적인 접근이 아닌것 같습니다."); +if (!chk_captcha("wr_key")) { + alert("자동등록방지 코드에 오류가 있습니다."); } $mb_id = trim(strip_tags(mysql_escape_string($_POST[mb_id]))); diff --git a/bbs/register_result.php b/bbs/register_result.php index 2265ecd84..3751f6cc0 100644 --- a/bbs/register_result.php +++ b/bbs/register_result.php @@ -1,12 +1,14 @@ $g4['path']."/plugin/captcha/captcha.lib.php", + 'js' => $g4['path']."/plugin/captcha/captcha.js" +); +?> \ No newline at end of file diff --git a/extend/tcaptcha.extend.php b/extend/tcaptcha.extend.php deleted file mode 100644 index 1c778f019..000000000 --- a/extend/tcaptcha.extend.php +++ /dev/null @@ -1,8 +0,0 @@ - $g4['path']."/plugin/tcaptcha/tcaptcha.lib.php", - 'js' => $g4['path']."/plugin/tcaptcha/tcaptcha.js" -); -?> \ No newline at end of file diff --git a/js/wrest.js b/js/wrest.js index c33c2ec0f..32e38169f 100644 --- a/js/wrest.js +++ b/js/wrest.js @@ -13,9 +13,7 @@ function wrestItemname(fld) function wrestTrim(fld) { var pattern = /(^\s+)|(\s+$)/g; // \s 공백 문자 - //(/^\s+|\s+$/g,""); - var str = fld.value.replace(pattern, ""); - return str; + return fld.value.replace(pattern, ""); } // 필수 입력 검사 @@ -60,7 +58,7 @@ function wrestEmail(fld) } } -// 한글인지 검사 (자음, 모음만 있는 한글은 불가) +// 한글인지 검사 (자음, 모음 조합된 한글만 가능) function wrestHangul(fld) { if (!wrestTrim(fld)) return; @@ -69,7 +67,7 @@ function wrestHangul(fld) if (pattern.test(fld.value)) { if (wrestFld == null) { - wrestMsg = wrestItemname(fld) + ' : 한글이 아닙니다. (자음, 모음만 있는 한글은 처리하지 않습니다.)\n'; + wrestMsg = wrestItemname(fld) + ' : 한글이 아닙니다. (자음, 모음 조합된 한글만 가능)\n'; wrestFld = fld; } } @@ -186,7 +184,7 @@ function wrestMinLength(fld, css) { if (!wrestTrim(fld)) return; - var str = css.split('='); // minlength=?? <-- str[1] + var str = css.split('_'); // minlength_?? <-- str[1] if (wrestFld == null) { if (fld.value.length < parseInt(str[1])) { @@ -283,8 +281,8 @@ function wrestSubmit() case "telnum" : wrestTelNum(el); break; // 김선용 2006.3 - 전화번호 형식 검사 case "imgext" : wrestImgExt(el); break; default : - // css 가 minlength= 로 시작한다면 = 뒤의 숫자는 최소길이값 - if (/^minlength\=/.test(css)) { + // css 가 minlength_ 로 시작한다면 _ 뒤의 숫자는 최소길이값 + if (/^minlength\_/.test(css)) { wrestMinLength(el, css); break; } else if (/^extension\=/.test(css)) { wrestExtension(el, css); break; diff --git a/lib/common.lib.php b/lib/common.lib.php index a6e5e65d5..014c8ddb1 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -1597,9 +1597,9 @@ function check_mb_nick($reg_mb_nick) // 별명은 한글, 영문, 숫자만 가능 if (!check_string($reg_mb_nick, _G4_HANGUL_ + _G4_ALPHABETIC_ + _G4_NUMERIC_)) { - return "공백없이 한글, 영문, 숫자만 입력 가능합니다."; + return "별명은 공백없이 한글, 영문, 숫자만 입력 가능합니다."; } else if (strlen($reg_mb_nick) < 4) { - return "한글 2글자, 영문 4글자 이상 입력 가능합니다."; + return "별명은 한글 2글자, 영문 4글자 이상 입력 가능합니다."; } else { $row = sql_fetch(" select count(*) as cnt from {$g4['member_table']} where mb_nick = '$reg_mb_nick' "); if ($row['cnt']) { diff --git a/plugin/captcha/captcha.js b/plugin/captcha/captcha.js index 6289dfc7b..7c87b4bcd 100644 --- a/plugin/captcha/captcha.js +++ b/plugin/captcha/captcha.js @@ -1,4 +1,4 @@ -function chk_captcha(input_key) +function check_captcha(input_key) { if (typeof(input_key) != "undefined") { var captcha_result = false; @@ -21,58 +21,16 @@ function chk_captcha(input_key) return true; } -function l_PlaySound(url, placeholderId) { - if (document.getElementById) { - var soundUrl = url; - var placeholder = document.getElementById(placeholderId); - - placeholder.innerHTML = ""; - - document.body.style.cursor = 'wait'; - var html5SoundPlayed = false; - var browserCompatibilityCheck = document.createElement('audio'); - if (!!(browserCompatibilityCheck.canPlayType) && - !!(browserCompatibilityCheck.canPlayType("audio/wav")) && - !l_DetectFirefox3()) { - sound = new Audio(soundUrl); - sound.id = 'LBD_CaptchaSoundAudio'; - sound.autoplay = true; - sound.controls = false; - sound.autobuffer = false; - sound.loop = false; - - placeholder.appendChild(sound); - html5SoundPlayed = true; - } - - if (!html5SoundPlayed) { - var objectSrc = ""; - - placeholder.innerHTML = objectSrc; - } - - document.body.style.cursor = 'default'; - } -} - -function l_DetectFirefox3() { - var detected = false; - if (navigator && navigator.userAgent) { - var matches = navigator.userAgent.match(/(Firefox)\/(3\.6\.[^;\+,\/\s]+)/); - if (matches) { - detected = true; - } - } - return detected; -} - $(function() { - $("#captcha").click(function() { + $("#captcha").click(function(e) { this.setAttribute("src", g4_path+"/plugin/captcha/run.php?t="+(new Date).getTime()); - //$("#captcha_key").focus();//이미지 새로고침 후 입력박스에 포커스 : 지운아빠 2012-07-13 - //캡챠 클릭 시에 포커스 줘야 하는데 페이지 새로 고침되면 포커스를 줘서 주석처리 : 지운아빠 2012-08-03 + var keycode = (e.keyCode ? e.keyCode : e.which); + // 첫 실행에서는 포커스를 주지 않음 + if (typeof(keycode) != "undefined") { + $("#captcha_key").focus();//이미지 새로고침 후 입력박스에 포커스 : 지운아빠 2012-07-13 + } }) - .css("cursor", "pointer") + .css("cursor", "pointer"); .trigger("click"); $("#captcha_wav").click(function(){ diff --git a/plugin/captcha/captcha.lib.php b/plugin/captcha/captcha.lib.php index 487fc1354..620d1f0d0 100644 --- a/plugin/captcha/captcha.lib.php +++ b/plugin/captcha/captcha.lib.php @@ -80,10 +80,6 @@ class captcha // The text to draw $captcha_key = $this->get_captcha_key(); - /* - $_SESSION['ss_captcha_key'] = $captcha_key; - $_SESSION['ss_captcha_cnt'] = 0; - */ set_session('ss_captcha_key', $captcha_key); set_session('ss_captcha_cnt', 0); diff --git a/skin/member/neo/register_form.skin.php b/skin/member/neo/register_form.skin.php index 10e3c4714..eabd35898 100644 --- a/skin/member/neo/register_form.skin.php +++ b/skin/member/neo/register_form.skin.php @@ -14,7 +14,6 @@ var member_skin_path = ""; - @@ -26,18 +25,18 @@ var member_skin_path = ""; - title="회원아이디"> + title="회원아이디"> 영문자, 숫자, _ 만 입력 가능. 최소 3자이상 입력하세요. - title="패스워드"> + maxlength="20" title="패스워드"> - title="패스워드 확인"> + maxlength="20" title="패스워드 확인"> @@ -46,7 +45,7 @@ var member_skin_path = ""; - title="이름"> + title="이름"> @@ -55,7 +54,7 @@ var member_skin_path = ""; - title="별명"> + title="별명">
공백없이 한글,영문,숫자만 입력 가능 (한글2자, 영문4자 이상)
별명을 바꾸시면 앞으로 일 이내에는 변경 할 수 없습니다. @@ -67,7 +66,7 @@ var member_skin_path = ""; - '> + ' maxlength="100" required="required" title="E-mail"> e-mail 로 발송된 내용을 확인한 후 인증하셔야 회원가입이 완료됩니다."; } ?> @@ -179,25 +178,23 @@ var member_skin_path = ""; - +
-