|
@@ -1310,6 +1326,52 @@ function set_point(f) {
}
}
+var captcha_chk = false;
+
+function use_captcha_check(){
+ $.ajax({
+ type: "POST",
+ url: g5_admin_url+"/ajax.use_captcha.php",
+ data: { admin_use_captcha: "1" },
+ cache: false,
+ async: false,
+ dataType: "json",
+ success: function(data) {
+ }
+ });
+}
+
+function frm_check_file(){
+ var bo_include_head = "";
+ var bo_include_tail = "";
+ var head = jQuery.trim(jQuery("#bo_include_head").val());
+ var tail = jQuery.trim(jQuery("#bo_include_tail").val());
+
+ if(bo_include_head !== head || bo_include_tail !== tail){
+ // 캡챠를 사용합니다.
+ jQuery("#admin_captcha_box").show();
+ captcha_chk = true;
+
+ use_captcha_check();
+
+ return false;
+ } else {
+ jQuery("#admin_captcha_box").hide();
+ }
+
+ return true;
+}
+
+jQuery(function($){
+ if( window.self !== window.top ){ // frame 또는 iframe을 사용할 경우 체크
+ $("#bo_include_head, #bo_include_tail").on("change paste keyup", function(e) {
+ frm_check_file();
+ });
+
+ use_captcha_check();
+ }
+});
+
function fboardform_submit(f)
{
@@ -1329,6 +1391,10 @@ function fboardform_submit(f)
return false;
}
+ if( captcha_chk ) {
+
+ }
+
return true;
}
diff --git a/adm/board_form_update.php b/adm/board_form_update.php
index 2f4816af6..b7e56ef8c 100644
--- a/adm/board_form_update.php
+++ b/adm/board_form_update.php
@@ -17,6 +17,15 @@ if (!$_POST['bo_subject']) { alert('게시판 제목을 입력하세요.'); }
$_POST['bo_include_head'] = preg_replace("#[\\\]+$#", "", substr($_POST['bo_include_head'], 0, 255));
$_POST['bo_include_tail'] = preg_replace("#[\\\]+$#", "", substr($_POST['bo_include_tail'], 0, 255));
+// 관리자가 자동등록방지를 사용해야 할 경우
+if ($board && ($board['bo_include_head'] !== $_POST['bo_include_head'] || $board['bo_include_tail'] !== $_POST['bo_include_tail']) && function_exists('get_admin_captcha_by') && get_admin_captcha_by()){
+ include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
+
+ if (!chk_captcha()) {
+ alert('자동등록방지 숫자가 틀렸습니다.');
+ }
+}
+
if ($file = $_POST['bo_include_head']) {
$file_ext = pathinfo($file, PATHINFO_EXTENSION);
@@ -426,5 +435,8 @@ if ($all_fields) {
delete_cache_latest($bo_table);
+if(function_exists('get_admin_captcha_by'))
+ get_admin_captcha_by('remove');
+
goto_url("./board_form.php?w=u&bo_table={$bo_table}&{$qstr}");
?>
diff --git a/adm/contentform.php b/adm/contentform.php
index 2d9d77565..024a17615 100644
--- a/adm/contentform.php
+++ b/adm/contentform.php
@@ -126,6 +126,22 @@ include_once (G5_ADMIN_PATH.'/admin.head.php');
|
+
|
@@ -185,7 +201,56 @@ include_once (G5_ADMIN_PATH.'/admin.head.php');
+
diff --git a/adm/contentformupdate.php b/adm/contentformupdate.php
index fa6a6048b..753c5e4bf 100644
--- a/adm/contentformupdate.php
+++ b/adm/contentformupdate.php
@@ -12,6 +12,23 @@ else
check_admin_token();
+if ($w == "" || $w == "u")
+{
+ if(preg_match("/[^a-z0-9_]/i", $co_id)) alert("ID 는 영문자, 숫자, _ 만 가능합니다.");
+
+ $sql = " select * from {$g5['content_table']} where co_id = '$co_id' ";
+ $co_row = sql_fetch($sql);
+}
+
+// 관리자가 자동등록방지를 사용해야 할 경우
+if (($co_row['co_include_head'] !== $_POST['co_include_head'] || $co_row['co_include_tail'] !== $_POST['co_include_tail']) && function_exists('get_admin_captcha_by') && get_admin_captcha_by()){
+ include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
+
+ if (!chk_captcha()) {
+ alert('자동등록방지 숫자가 틀렸습니다.');
+ }
+}
+
@mkdir(G5_DATA_PATH."/content", G5_DIR_PERMISSION);
@chmod(G5_DATA_PATH."/content", G5_DIR_PERMISSION);
@@ -21,17 +38,19 @@ if ($co_timg_del) @unlink(G5_DATA_PATH."/content/{$co_id}_t");
$error_msg = '';
if( $co_include_head ){
- $purl = parse_url($co_include_head);
- $file = $purl['path'];
- if (!preg_match("/\.(php|htm['l']?)$/i", $file)) {
+
+ $file_ext = pathinfo($co_include_head, PATHINFO_EXTENSION);
+
+ if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) ) {
alert('상단 파일 경로의 확장자는 php, html 만 허용합니다.');
}
}
if( $co_include_tail ){
- $purl = parse_url($co_include_tail);
- $file = $purl['path'];
- if (!preg_match("/\.(php|htm['l']?)$/i", $file)) {
+
+ $file_ext = pathinfo($co_include_tail, PATHINFO_EXTENSION);
+
+ if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) ) {
alert('하단 파일 경로의 확장자는 php, html 만 허용합니다.');
}
}
@@ -58,11 +77,7 @@ $sql_common = " co_include_head = '$co_include_head',
if ($w == "")
{
- //if(eregi("[^a-z0-9_]", $co_id)) alert("ID 는 영문자, 숫자, _ 만 가능합니다.");
- if(preg_match("/[^a-z0-9_]/i", $co_id)) alert("ID 는 영문자, 숫자, _ 만 가능합니다.");
-
- $sql = " select co_id from {$g5['content_table']} where co_id = '$co_id' ";
- $row = sql_fetch($sql);
+ $row = $co_row;
if ($row['co_id'])
alert("이미 같은 ID로 등록된 내용이 있습니다.");
@@ -87,6 +102,9 @@ else if ($w == "d")
sql_query($sql);
}
+if(function_exists('get_admin_captcha_by'))
+ get_admin_captcha_by('remove');
+
if ($w == "" || $w == "u")
{
if ($_FILES['co_himg']['name'])
diff --git a/adm/css/admin.css b/adm/css/admin.css
index 0604c4f5f..5b31afdc1 100644
--- a/adm/css/admin.css
+++ b/adm/css/admin.css
@@ -685,6 +685,15 @@ box-shadow: 2px 2px 3px 0px rgba(0,0,0,0.2);}
.sevice_2 .svc_design{overflow:hidden;height:210px;position:relative}
.sevice_2 .svc_design .svc_btn a{margin:0 0 20px}
+/* 캡챠 */
+#captcha {display:inline-block;position:relative}
+#captcha legend {position:absolute;margin:0;padding:0;font-size:0;line-height:0;text-indent:-9999em;overflow:hidden;}
+#captcha #captcha_img {;height:40px;border:1px solid #898989;vertical-align:top;padding:0;margin:0}
+#captcha #captcha_mp3 {;margin:0;padding:0;width:40px;height:40px;border:0;background:transparent;vertical-align:middle;overflow:hidden;cursor:pointer;background:url('../../img/captcha2.png') no-repeat;text-indent:-999px;border-radius:3px}
+#captcha #captcha_reload {margin:0;padding:0;width:40px;height:40px;border:0;background:transparent;vertical-align:middle;overflow:hidden;cursor:pointer;background:url('../../img/captcha2.png') no-repeat 0 -40px;text-indent:-999px;border-radius:3px}
+#captcha #captcha_key {margin:0 0 0 3px;padding:0 5px;width:90px;height:40px;border:1px solid #ccc;background:#fff;font-size:1.333em;font-weight:bold;text-align:center;border-radius:3px;vertical-align:top}
+#captcha #captcha_info {display:block;margin:5px 0 0;font-size:0.95em;letter-spacing:-0.1em}
+
/*테마*/
.theme_p{margin:0 0 10px }
#theme_list{padding:0;margin:0;list-style:none; width: 1000px;position:relative}
diff --git a/adm/qa_config.php b/adm/qa_config.php
index d07e03264..312dcd8cd 100644
--- a/adm/qa_config.php
+++ b/adm/qa_config.php
@@ -263,6 +263,22 @@ if(!isset($qaconfig['qa_include_head'])) {
|
+