KCAPTCHA 캡챠 플러그인 추가
This commit is contained in:
3
plugin/gcaptcha/captcha.lib.php
Normal file
3
plugin/gcaptcha/captcha.lib.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
require(dirname(__FILE__).'/gcaptcha.lib.php');
|
||||
?>
|
||||
@ -6,7 +6,7 @@ function chk_captcha()
|
||||
var captcha_result = false;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: g5_gcaptcha_url+"/get.php",
|
||||
url: g5_captcha_url+"/get.php",
|
||||
data: {
|
||||
"captcha_key": captcha_key.value
|
||||
},
|
||||
@ -19,6 +19,7 @@ function chk_captcha()
|
||||
if (!captcha_result) {
|
||||
alert("자동등록방지 숫자가 틀렸습니다.");
|
||||
captcha_key.select();
|
||||
captcha_key.focus();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -26,7 +27,7 @@ function chk_captcha()
|
||||
|
||||
$(function() {
|
||||
$("#captcha").click(function(e) {
|
||||
this.setAttribute("src", g5_url+"/plugin/gcaptcha/run.php?t="+(new Date).getTime());
|
||||
this.setAttribute("src", g5_captcha_url+"/run.php?t="+(new Date).getTime());
|
||||
var keycode = (e.keyCode ? e.keyCode : e.which);
|
||||
// 첫 실행에서는 포커스를 주지 않음
|
||||
if (typeof(keycode) != "undefined") {
|
||||
|
||||
@ -100,7 +100,7 @@ class gcaptcha
|
||||
|
||||
// Replace path by your own font path
|
||||
$fonts = Array();
|
||||
foreach (glob(G5_GCAPTCHA_PATH.'/fonts/*.ttf') as $filename) {
|
||||
foreach (glob(G5_CAPTCHA_PATH.'/fonts/*.ttf') as $filename) {
|
||||
$fonts[] = $filename;
|
||||
}
|
||||
$font = $fonts[mt_rand(0, count($fonts)-1)];
|
||||
@ -140,7 +140,7 @@ class gcaptcha
|
||||
$number = (string)$_SESSION['ss_captcha_key'];
|
||||
$mp3s = array();
|
||||
for($i=0;$i<strlen($number);$i++){
|
||||
$file = G5_GCAPTCHA_PATH.'/mp3/'.$config['cf_gcaptcha_mp3'].'/'.$number[$i].'.mp3';
|
||||
$file = G5_CAPTCHA_PATH.'/mp3/'.$config['cf_captcha_mp3'].'/'.$number[$i].'.mp3';
|
||||
$mp3s[] = $file;
|
||||
}
|
||||
|
||||
@ -179,13 +179,13 @@ function captcha_html($class='captcha')
|
||||
$jpg_file_url = G5_DATA_URL.'/cache/'.$obj->captcha_filename.'.jpg';
|
||||
$mp3_file_url = G5_DATA_URL.'/cache/'.$obj->captcha_filename.'.mp3';
|
||||
|
||||
$html .= "\n".'<script>var g5_gcaptcha_url = "'.G5_GCAPTCHA_URL.'";</script>';
|
||||
$html .= "\n".'<script src="'.G5_GCAPTCHA_URL.'/gcaptcha.js"></script>';
|
||||
$html .= "\n".'<script>var g5_captcha_url = "'.G5_CAPTCHA_URL.'";</script>';
|
||||
$html .= "\n".'<script src="'.G5_CAPTCHA_URL.'/gcaptcha.js"></script>';
|
||||
$html .= '<fieldset id="captcha" class="'.$class.'">';
|
||||
$html .= '<legend class="sound_only">자동등록방지</legend>';
|
||||
if (G5_IS_MOBILE) $html .= '<audio src="'.$mp3_file_url.'?_='.$rand.'" controls></audio>';
|
||||
$html .= '<img src="'.$jpg_file_url.'?_='.$rand.'" alt="">';
|
||||
if (!G5_IS_MOBILE) $html .= '<a href="'.$mp3_file_url.'?_='.$rand.'" id="captcha_mp3" target="_blank"><img src="'.G5_GCAPTCHA_URL.'/img/sound.gif" alt="숫자를 음성으로 듣기"></a>';
|
||||
if (!G5_IS_MOBILE) $html .= '<a href="'.$mp3_file_url.'?_='.$rand.'" id="captcha_mp3" target="_blank"><img src="'.G5_CAPTCHA_URL.'/img/sound.gif" alt="숫자를 음성으로 듣기"></a>';
|
||||
$html .= '<label class="sound_only">자동등록방지 숫자 </label><input type="text" name="captcha_key" id="captcha_key" required class="captcha_box frm_input required" size="6" maxlength="6">';
|
||||
$html .= '<p class="sound_only">자동등록방지 숫자를 순서대로 입력하세요.</p>';
|
||||
$html .= '</fieldset>';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
include_once("./_common.php");
|
||||
include_once(G5_GCAPTCHA_PATH.'/gcaptcha.lib.php');
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
|
||||
echo chk_captcha();
|
||||
?>
|
||||
Reference in New Issue
Block a user