Skip to content

Commit

Permalink
반응형 대비 캡챠 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
chicpro committed Oct 6, 2015
1 parent 273983c commit 0803de9
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 13 deletions.
8 changes: 7 additions & 1 deletion css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -283,4 +283,10 @@ a.btn_admin:focus, a.btn_admin:hover {text-decoration:none}

/*메일인증*/
.rg_em{margin-top:5px}
.rg_em caption{padding:0;font-size:0;line-height:0;overflow:hidden}
.rg_em caption{padding:0;font-size:0;line-height:0;overflow:hidden}

/*캡챠 모바일에서 피시버젼*/
#captcha.m_captcha audio{display:block;margin:5px 0 10px;}
#captcha.m_captcha #captcha_key{margin-left:3px }
#captcha.m_captcha #captcha_reload span{background:none;display:inline}
#captcha.m_captcha #captcha_reload {position:relative ;width:auto;top:0;left:0;margin:0;padding:0 10px;height:43px;border:0;background:#e4eaec;vertical-align:middle;overflow:hidden;cursor:pointer}
12 changes: 12 additions & 0 deletions css/mobile.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ a:hover, a:focus, a:active {color:#000;text-decoration:underline}
/* 화면낭독기 사용자용 */
#hd_login_msg {position:absolute;top:0;left:0;width:0;height:0;overflow:hidden}
.msg_sound_only, .sound_only {display:inline-block;position:absolute;top:0;left:0;margin:0 !important;padding:0 !important;width:1px !important;height:1px !important;font-size:0 !important;line-height:0 !important;overflow:hidden}

/* 본문 바로가기 */
.to_content a {z-index:100000;position:absolute;top:0;left:0;width:0;height:0;font-size:0;line-height:0;overflow:hidden}

Expand All @@ -116,6 +117,17 @@ a:hover, a:focus, a:active {color:#000;text-decoration:underline}
#captcha #captcha_reload {margin:0;padding:0 5px;height:32px;border:0;background:#e4eaec;vertical-align:middle;overflow:hidden;cursor:pointer}
#captcha #captcha_key {margin:0 0 0 4px;padding:0 5px;width:50px;height:30px;border:1px solid #b8c9c2;background:#f7f7f7;font-size:1.333em;font-weight:bold;text-align:center;line-height:2em}
#captcha #captcha_info {display:block;margin:5px 0 0;font-size:0.95em;letter-spacing:-0.1em}
#captcha #captcha_mp3{margin:0;padding:0 5px;height:32px;border:0;background:#e4eaec;vertical-align:middle;overflow:hidden;cursor:pointer}

/*단축키일람 */
.btn_cke_sc{background:#333;color:#fff;padding:5px;border:none;margin-bottom:5px}
.cke_sc_def {margin:0 0 5px;padding:10px;border:1px solid #ccc;background:#f7f7f7;text-align:center}
.cke_sc_def dl{margin:0 0 5px;text-align:left;zoom:1}
.cke_sc_def dl:after {display:block;visibility:hidden;clear:both;content:""}
.cke_sc_def dt, .cke_sc_def dd {float:left;margin:0;padding:5px 0;border-bottom:1px solid #e9e9e9}
.cke_sc_def dt {width:50%;font-weight:bold}
.cke_sc_def dd {width:50%}
.btn_cke_sc_close{background:#333;padding:5px;border:none;color:#fff}

/* 버튼 */
a.btn01 {display:inline-block;padding:8px 7px 7px;border:1px solid #ccc;background:#fafafa;color:#000;text-decoration:none;vertical-align:middle}
Expand Down
25 changes: 14 additions & 11 deletions plugin/kcaptcha/kcaptcha.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ function image(){
}
}
closedir($handle);
}
}

$alphabet_length=strlen($alphabet);

do{
/*
// generating random keystring
Expand Down Expand Up @@ -132,7 +132,7 @@ function image(){
$img2=imagecreatetruecolor($width, $height+($show_credits?12:0));
$foreground=imagecolorallocate($img2, $foreground_color[0], $foreground_color[1], $foreground_color[2]);
$background=imagecolorallocate($img2, $background_color[0], $background_color[1], $background_color[2]);
imagefilledrectangle($img2, 0, 0, $width-1, $height-1, $background);
imagefilledrectangle($img2, 0, 0, $width-1, $height-1, $background);
imagefilledrectangle($img2, 0, $height, $width-1, $height+12, $foreground);
$credits=empty($credits)?$_SERVER['HTTP_HOST']:$credits;
imagestring($img2, 2, $width/2-imagefontwidth(2)*strlen($credits)/2, $height-2, $credits, $background);
Expand Down Expand Up @@ -203,12 +203,12 @@ function image(){
imagesetpixel($img2, $x, $y, imagecolorallocate($img2, $newred, $newgreen, $newblue));
}
}
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);

header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');

if(function_exists("imagejpeg")){
header("Content-Type: image/jpeg");
imagejpeg($img2, null, $jpeg_quality);
Expand All @@ -235,15 +235,18 @@ function setKeyString($str){
// 캡챠 HTML 코드 출력
function captcha_html($class="captcha")
{
if(is_mobile())
$class .= ' m_captcha';

$html .= "\n".'<script>var g5_captcha_url = "'.G5_CAPTCHA_URL.'";</script>';
//$html .= "\n".'<script>var g5_captcha_path = "'.G5_CAPTCHA_PATH.'";</script>';
$html .= "\n".'<script src="'.G5_CAPTCHA_URL.'/kcaptcha.js"></script>';
$html .= "\n".'<fieldset id="captcha" class="'.$class.'">';
$html .= "\n".'<legend><label for="captcha_key">자동등록방지</label></legend>';
if (G5_IS_MOBILE) $html .= '<audio src="#" id="captcha_audio" controls></audio>';
if (is_mobile()) $html .= '<audio src="#" id="captcha_audio" controls></audio>';
//$html .= "\n".'<img src="#" alt="" id="captcha_img">';
$html .= "\n".'<img src="javascript:void(0);" alt="" id="captcha_img">';
if (!G5_IS_MOBILE) $html .= "\n".'<button type="button" id="captcha_mp3"><span></span>숫자음성듣기</button>';
if (!is_mobile()) $html .= "\n".'<button type="button" id="captcha_mp3"><span></span>숫자음성듣기</button>';
$html .= "\n".'<button type="button" id="captcha_reload"><span></span>새로고침</button>';
$html .= '<input type="text" name="captcha_key" id="captcha_key" required class="captcha_box required" size="6" maxlength="6">';
$html .= "\n".'<span id="captcha_info">자동등록방지 숫자를 순서대로 입력하세요.</span>';
Expand Down
8 changes: 7 additions & 1 deletion theme/basic/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,10 @@ a.btn_admin:focus, a.btn_admin:hover {text-decoration:none}
.pg_current {display:inline-block;margin:0 4px 0 0;background:#333;color:#fff;font-weight:normal}

/* Mobile화면으로 */
#device_change {display:block;margin:0.3em;padding:0.5em 0;border:1px solid #eee;border-radius:2em;background:#fff;color:#000;font-size:2em;text-decoration:none;text-align:center}
#device_change {display:block;margin:0.3em;padding:0.5em 0;border:1px solid #eee;border-radius:2em;background:#fff;color:#000;font-size:2em;text-decoration:none;text-align:center}

/*캡챠 모바일에서 피시버젼*/
#captcha.m_captcha audio{display:block;margin:5px 0 10px}
#captcha.m_captcha #captcha_key{margin-left:3px }
#captcha.m_captcha #captcha_reload span{background:none;display:inline}
#captcha.m_captcha #captcha_reload {position:relative ;width:auto;top:0;left:0;margin:0;padding:0 10px;height:43px;border:0;background:#e4eaec;vertical-align:middle;overflow:hidden;cursor:pointer}
12 changes: 12 additions & 0 deletions theme/basic/css/mobile.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ a:hover, a:focus, a:active {color:#000;text-decoration:underline}
/* 화면낭독기 사용자용 */
#hd_login_msg {position:absolute;top:0;left:0;width:0;height:0;overflow:hidden}
.msg_sound_only, .sound_only {display:inline-block;position:absolute;top:0;left:0;margin:0 !important;padding:0 !important;width:1px !important;height:1px !important;font-size:0 !important;line-height:0 !important;overflow:hidden}

/* 본문 바로가기 */
.to_content a {z-index:100000;position:absolute;top:0;left:0;width:0;height:0;font-size:0;line-height:0;overflow:hidden}

Expand All @@ -116,6 +117,17 @@ a:hover, a:focus, a:active {color:#000;text-decoration:underline}
#captcha #captcha_reload {margin:0;padding:0 5px;height:32px;border:0;background:#e4eaec;vertical-align:middle;overflow:hidden;cursor:pointer}
#captcha #captcha_key {margin:0 0 0 4px;padding:0 5px;width:50px;height:30px;border:1px solid #b8c9c2;background:#f7f7f7;font-size:1.333em;font-weight:bold;text-align:center;line-height:2em}
#captcha #captcha_info {display:block;margin:5px 0 0;font-size:0.95em;letter-spacing:-0.1em}
#captcha #captcha_mp3{margin:0;padding:0 5px;height:32px;border:0;background:#e4eaec;vertical-align:middle;overflow:hidden;cursor:pointer}

/*단축키일람 */
.btn_cke_sc{background:#333;color:#fff;padding:5px;border:none;margin-bottom:5px}
.cke_sc_def {margin:0 0 5px;padding:10px;border:1px solid #ccc;background:#f7f7f7;text-align:center}
.cke_sc_def dl{margin:0 0 5px;text-align:left;zoom:1}
.cke_sc_def dl:after {display:block;visibility:hidden;clear:both;content:""}
.cke_sc_def dt, .cke_sc_def dd {float:left;margin:0;padding:5px 0;border-bottom:1px solid #e9e9e9}
.cke_sc_def dt {width:50%;font-weight:bold}
.cke_sc_def dd {width:50%}
.btn_cke_sc_close{background:#333;padding:5px;border:none;color:#fff}

/* 버튼 */
a.btn01 {display:inline-block;padding:8px 7px 7px;border:1px solid #ccc;background:#fafafa;color:#000;text-decoration:none;vertical-align:middle}
Expand Down

0 comments on commit 0803de9

Please sign in to comment.