diff --git a/bbs/board.php b/bbs/board.php
index 88469ff61..938e1ec04 100644
--- a/bbs/board.php
+++ b/bbs/board.php
@@ -1,4 +1,5 @@
+define('_CAPTCHA_', true);
include_once('./_common.php');
if (!$board['bo_table']) {
diff --git a/bbs/view_comment.php b/bbs/view_comment.php
index 8653dfc66..5248a905c 100644
--- a/bbs/view_comment.php
+++ b/bbs/view_comment.php
@@ -1,6 +1,11 @@
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
+$captcha_html = "";
+if ($is_guest) {
+ $captcha_html = captcha_html('wr_key', '_comment');
+}
+
@include_once($board_skin_path.'/view_comment.head.skin.php');
// 코멘트를 새창으로 여는 경우 세션값이 없으므로 생성한다.
diff --git a/bbs/write.php b/bbs/write.php
index 9b96575f6..f61c20e37 100644
--- a/bbs/write.php
+++ b/bbs/write.php
@@ -1,4 +1,5 @@
+define('_CAPTCHA_', true);
include_once('./_common.php');
set_session('ss_bo_table', $bo_table);
@@ -204,6 +205,11 @@ if ($board['bo_use_dhtml_editor'] && $member['mb_level'] >= $board['bo_html_leve
$is_dhtml_editor = false;
}
+$captcha_html = "";
+if ($is_guest) {
+ $captcha_html = captcha_html('wr_key');
+}
+
$is_mail = false;
if ($config['cf_email_use'] && $board['bo_use_email'])
$is_mail = true;
@@ -247,6 +253,8 @@ if ($board['bo_use_file_content']) {
$is_file_content = true;
}
+$file_count = (int)$board['bo_upload_count'];
+
$name = "";
$email = "";
$homepage = "";
@@ -350,34 +358,6 @@ if ($is_admin) {
include_once($g4['path'].'/head.sub.php');
include_once('./board_head.php');
-//--------------------------------------------------------------------------
-// 가변 파일
-$file_script = '';
-$file_length = -1;
-// 수정의 경우 파일업로드 필드가 가변적으로 늘어나야 하고 삭제 표시도 해주어야 합니다.
-if ($w == 'u') {
- for ($i=0; $i<$file['count']; $i++) {
- $row = sql_fetch(" select bf_file, bf_content from {$g4['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
- if ($row['bf_file']) {
- $file_script .= 'add_file("'.$file[$i]['source'].'('.$file[$i]['size'].') 파일 삭제';
- if ($is_file_content)
- //$file_script .= '
';
- // 첨부파일설명에서 ' 또는 " 입력되면 오류나는 부분 수정
- $file_script .= '
';
- $file_script .= '\");'.PHP_EOL;
- }
- else
- $file_script .= 'add_file("");'.PHP_EOL;
- }
- $file_length = $file['count'] - 1;
-}
-
-if ($file_length < 0) {
- $file_script .= 'add_file("");'.PHP_EOL;
- $file_length = 0;
-}
-//--------------------------------------------------------------------------
-
if ($g4['https_url'])
$action_url = "{$g4['https_url']}/{$g4['bbs']}/write_update.php";
else
diff --git a/bbs/write_update.php b/bbs/write_update.php
index 77669e82c..b010365f7 100644
--- a/bbs/write_update.php
+++ b/bbs/write_update.php
@@ -1,4 +1,5 @@
+define('_CAPTCHA_', true);
include_once('./_common.php');
$g4['title'] = '게시글 저장';
@@ -150,7 +151,7 @@ if ($w == '' || $w == 'u') {
alert('w 값이 제대로 넘어오지 않았습니다.');
}
-if (!chk_captcha()) {
+if (!chk_captcha('wr_key')) {
alert('자동등록방지의 답변으로 입력한 숫자가 틀렸습니다.');
}
diff --git a/extend/captcha.extend.php b/extend/captcha.extend.php
index b4e5cdf66..c70a26aef 100644
--- a/extend/captcha.extend.php
+++ b/extend/captcha.extend.php
@@ -8,5 +8,7 @@ if (defined('_CAPTCHA_')) {
);
include_once($captcha->lib);
+} else {
+ unset($_SESSION['ss_captcha_use']);
}
?>
\ No newline at end of file
diff --git a/head.sub.php b/head.sub.php
index 143df8691..fc3584c1e 100644
--- a/head.sub.php
+++ b/head.sub.php
@@ -58,6 +58,7 @@ header("Pragma: no-cache"); // HTTP/1.0
// 자바스크립트에서 사용하는 전역변수 선언
var g4_path = "=$g4['path']?>";
var g4_bbs = "=$g4['bbs']?>";
+var g4_bbs_path = "=$g4['bbs_path']?>";
var g4_bbs_img = "=$g4['bbs_img']?>";
var g4_url = "=$g4['url']?>";
var g4_is_member = "=isset($is_member)?$is_member:'';?>";
diff --git a/plugin/captcha/captcha.lib.php b/plugin/captcha/captcha.lib.php
index 27ea46418..57e0a5763 100644
--- a/plugin/captcha/captcha.lib.php
+++ b/plugin/captcha/captcha.lib.php
@@ -137,25 +137,24 @@ $captcha->run();
*/
// 캡챠이미지는 한개만 사용 가능함.
-function get_captcha($input_name, $captcha_no)
+function captcha_html($input_name, $captcha_id_suffix='')
{
global $g4;
// 세션생성을 한후 다음페이지에서 해당 세션이 있을때만 올바른 캡챠코드인지 비교합니다.
set_session('ss_captcha_use', true);
- $captcha_class = str_pad($captcha_no,2,'0',STR_PAD_LEFT);// 캡챠 클래스를 선택할 수 있도록 지운아빠 2012-07-24
- $code = '