adm quotation

This commit is contained in:
chicpro
2012-11-02 11:57:00 +09:00
parent d3ab4acee1
commit 70e70f7909
10 changed files with 399 additions and 394 deletions

View File

@ -1,5 +1,5 @@
<? <?
$g4_path = ".."; // common.php 의 상대 경로 $g4_path = ".."; // common.php 의 상대 경로
include_once ("$g4_path/common.php"); include_once ($g4_path.'/common.php');
include_once("$g4[admin_path]/admin.lib.php"); include_once($g4['admin_path'].'/admin.lib.php');
?> ?>

View File

@ -13,7 +13,7 @@ $sql_search = " where (1) ";
if ($stx) { if ($stx) {
$sql_search .= " and ( "; $sql_search .= " and ( ";
switch ($sfl) { switch ($sfl) {
default : default :
$sql_search .= " ($sfl like '%$stx%') "; $sql_search .= " ($sfl like '%$stx%') ";
break; break;
} }
@ -27,18 +27,18 @@ if (!$sst) {
$sql_order = " order by $sst $sod "; $sql_order = " order by $sst $sod ";
$sql = " select count(*) as cnt $sql = " select count(*) as cnt
$sql_common $sql_common
$sql_search $sql_search
$sql_order "; $sql_order ";
$row = sql_fetch($sql); $row = sql_fetch($sql);
$total_count = $row[cnt]; $total_count = $row['cnt'];
$rows = $config[cf_page_rows]; $rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산 $total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지) if ($page == "") $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함 $from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select * $sql = " select *
$sql_common $sql_common
$sql_search $sql_search
$sql_order $sql_order
@ -50,7 +50,7 @@ if ($sfl || $stx || $sod) // 검색 혹은 정렬일 때만 처음 버튼을 보
$listall = '<a href="'.$_SERVER['PHP_SELF'].'">처음으로</a>'; $listall = '<a href="'.$_SERVER['PHP_SELF'].'">처음으로</a>';
$g4['title'] = "관리권한설정"; $g4['title'] = "관리권한설정";
include_once("./admin.head.php"); include_once('./admin.head.php');
$colspan = 5; $colspan = 5;
?> ?>
@ -91,7 +91,7 @@ var list_delete_php = 'auth_list_delete.php';
</thead> </thead>
<tbody> <tbody>
<? <?
for ($i=0; $row=sql_fetch_array($result); $i++) for ($i=0; $row=sql_fetch_array($result); $i++)
{ {
$mb_nick = get_sideview($row['mb_id'], $row['mb_nick'], $row['mb_email'], $row['mb_homepage']); $mb_nick = get_sideview($row['mb_id'], $row['mb_nick'], $row['mb_email'], $row['mb_homepage']);
@ -118,7 +118,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
<? <?
} }
if ($i==0) if ($i==0)
echo '<tr><td colspan="'.$colspan.'">자료가 없습니다.</td></tr>'; echo '<tr><td colspan="'.$colspan.'">자료가 없습니다.</td></tr>';
?> ?>
</tbody> </tbody>

View File

@ -1,6 +1,6 @@
<? <?
$sub_menu = "100200"; $sub_menu = "100200";
include_once("./_common.php"); include_once('./_common.php');
check_demo(); check_demo();
@ -9,14 +9,14 @@ if ($is_admin != 'super')
check_token(); check_token();
for ($i=0; $i<count($chk); $i++) for ($i=0; $i<count($chk); $i++)
{ {
// 실제 번호를 넘김 // 실제 번호를 넘김
$k = $chk[$i]; $k = $chk[$i];
$sql = " delete from {$g4[auth_table]} where mb_id = '{$_POST['mb_id'][$k]}' and au_menu = '{$_POST['au_menu'][$k]}' "; $sql = " delete from {$g4['auth_table']} where mb_id = '{$_POST['mb_id'][$k]}' and au_menu = '{$_POST['au_menu'][$k]}' ";
sql_query($sql); sql_query($sql);
} }
goto_url('./auth_list.php?$qstr'); goto_url('./auth_list.php?'.$qstr);
?> ?>

View File

@ -7,7 +7,7 @@ if ($is_admin != 'super')
$mb = get_member($mb_id); $mb = get_member($mb_id);
if (!$mb['mb_id']) if (!$mb['mb_id'])
alert('존재하는 회원아이디가 아닙니다.'); alert('존재하는 회원아이디가 아닙니다.');
check_token(); check_token();
@ -15,20 +15,20 @@ if ($member['mb_password'] != sql_password($_POST['admin_password'])) {
alert('패스워드가 다릅니다.'); alert('패스워드가 다릅니다.');
} }
$sql = " insert into {$g4[auth_table]} $sql = " insert into {$g4['auth_table']}
set mb_id = '{$_POST['mb_id']}', set mb_id = '{$_POST['mb_id']}',
au_menu = '$_POST[au_menu]', au_menu = '{$_POST['au_menu']}',
au_auth = '{$_POST['r']},{$_POST[$w]},{$_POST[$d]}' "; au_auth = '{$_POST['r']},{$_POST['w']},{$_POST['d']}' ";
$result = sql_query($sql, FALSE); $result = sql_query($sql, FALSE);
if (!$result) { if (!$result) {
$sql = " update $g4[auth_table] $sql = " update $g4['auth_table']
set au_auth = '{$_POST[r]},{$_POST[$w]},{$_POST[$d]}' set au_auth = '{$_POST[r]},{$_POST['w']},{$_POST['d']}'
where mb_id = '{$_POST['mb_id']}' where mb_id = '{$_POST['mb_id']}'
and au_menu = '$_POST[au_menu]' "; and au_menu = '{$_POST['au_menu']}' ";
sql_query($sql); sql_query($sql);
} }
//sql_query(" OPTIMIZE TABLE `$g4[auth_table]` "); //sql_query(" OPTIMIZE TABLE `$g4[auth_table]` ");
goto_url('./auth_list.php?$qstr'); goto_url('./auth_list.php?'.$qstr);
?> ?>

View File

@ -7,7 +7,7 @@ auth_check($auth[$sub_menu], 'w');
$token = get_token(); $token = get_token();
$g4[title] = '게시판 복사'; $g4[title] = '게시판 복사';
include_once('$g4['path']/head.sub.php'); include_once($g4['path'].'/head.sub.php');
?> ?>
<link rel='stylesheet' href='./admin.style.css' type='text/css'> <link rel='stylesheet' href='./admin.style.css' type='text/css'>
@ -20,7 +20,7 @@ include_once('$g4['path']/head.sub.php');
<colgroup width=70% class="col2 pad2"> <colgroup width=70% class="col2 pad2">
<tr><td colspan=2 height=5></td></tr> <tr><td colspan=2 height=5></td></tr>
<tr> <tr>
<td colspan=2 class=title align=left><img src="<?=$g4["admin_path"]?>/img/icon_title.gif"> <?=$g4[title]?></td> <td colspan=2 class=title align=left><img src="<?=$g4['admin_path']?>/img/icon_title.gif"> <?=$g4['title']?></td>
</tr> </tr>
<tr><td colspan=2 class="line1"></td></tr> <tr><td colspan=2 class="line1"></td></tr>
<tr class="ht"> <tr class="ht">
@ -33,7 +33,7 @@ include_once('$g4['path']/head.sub.php');
</tr> </tr>
<tr class="ht"> <tr class="ht">
<td>게시판 제목</td> <td>게시판 제목</td>
<td><input type='text' class=ed id='target_subject' name='target_subject' size=60 maxlength=120 required 제목" value="[복사본] <?=$board[bo_subject]?>"></td> <td><input type='text' class=ed id='target_subject' name='target_subject' size=60 maxlength=120 required 제목" value="[복사본] <?=$board['bo_subject']?>"></td>
</tr> </tr>
<tr class="ht"> <tr class="ht">
<td>복사 유형</td> <td>복사 유형</td>
@ -62,5 +62,5 @@ function fboardcopy_check(f)
</script> </script>
<? <?
include_once('$g4['path']/tail.sub.php'); include_once($g4['path'].'/tail.sub.php');
?> ?>

View File

@ -4,112 +4,112 @@ include_once('./_common.php');
auth_check($auth[$sub_menu], 'w'); auth_check($auth[$sub_menu], 'w');
$target_table = mysql_real_escape_string(trim($_POST["target_table"])); $target_table = mysql_real_escape_string(trim($_POST['target_table']));
$target_subject = mysql_real_escape_string(trim($_POST["target_subject"])); $target_subject = mysql_real_escape_string(trim($_POST['target_subject']));
if (!preg_match('/[A-Za-z0-9_]{1,20}/', $target_table)) if (!preg_match('/[A-Za-z0-9_]{1,20}/', $target_table))
{ {
alert('게시판 TABLE명은 공백없이 영문자, 숫자, _ 만 사용 가능합니다. (20자 이내)'); alert('게시판 TABLE명은 공백없이 영문자, 숫자, _ 만 사용 가능합니다. (20자 이내)');
} }
$row = sql_fetch(' select count(*) as cnt from $g4[board_table] where bo_table = "$target_table" '); $row = sql_fetch(" select count(*) as cnt from {$g4['board_table']} where bo_table = $target_table ");
if ($row[cnt]) if ($row['cnt'])
alert('{$target_table}은(는) 이미 존재하는 게시판 TABLE 입니다.\\n\\n복사할 TABLE로 사용할 수 없습니다.'); alert($target_table.'은(는) 이미 존재하는 게시판 TABLE 입니다.\\n\\n복사할 TABLE로 사용할 수 없습니다.');
check_token(); check_token();
// 게시판 테이블 생성 // 게시판 테이블 생성
$sql = get_table_define($g4[write_prefix] . $bo_table); $sql = get_table_define($g4['write_prefix'] . $bo_table);
$sql = str_replace($g4[write_prefix] . $bo_table, $g4[write_prefix] . $target_table, $sql); $sql = str_replace($g4['write_prefix'] . $bo_table, $g4['write_prefix'] . $target_table, $sql);
sql_query($sql); sql_query($sql);
$file_copy = array(); $file_copy = array();
// 게시판 정보 // 게시판 정보
$sql = ' insert into $g4[board_table] $sql = " insert into {$g4['board_table']}
set bo_table = "$target_table", set bo_table = '$target_table',
bo_subject = "$target_subject", bo_subject = '$target_subject',
gr_id = "$board[gr_id]", gr_id = '{$board['gr_id']}',
bo_admin = "$board[bo_admin]", bo_admin = '{$board['bo_admin']}',
bo_list_level = "$board[bo_list_level]", bo_list_level = '{$board['bo_list_level']}',
bo_read_level = "$board[bo_read_level]", bo_read_level = '{$board['bo_read_level']}',
bo_write_level = "$board[bo_write_level]", bo_write_level = '{$board['bo_write_level']}',
bo_reply_level = "$board[bo_reply_level]", bo_reply_level = '{$board['bo_reply_level']}',
bo_comment_level = "$board[bo_comment_level]", bo_comment_level = '{$board['bo_comment_level']}',
bo_upload_level = "$board[bo_upload_level]", bo_upload_level = '{$board['bo_upload_level']}',
bo_download_level = "$board[bo_download_level]", bo_download_level = '{$board['bo_download_level']}',
bo_html_level = "$board[bo_html_level]", bo_html_level = '{$board['bo_html_level']}',
bo_link_level = "$board[bo_link_level]", bo_link_level = '{$board['bo_link_level']}',
bo_trackback_level = "$board[bo_trackback_level]", bo_trackback_level = '{$board['bo_trackback_level']}',
bo_count_modify = "$board[bo_count_modify]", bo_count_modify = '{$board['bo_count_modify']}',
bo_count_delete = "$board[bo_count_delete]", bo_count_delete = '{$board['bo_count_delete']}',
bo_read_point = "$board[bo_read_point]", bo_read_point = '{$board['bo_read_point']}',
bo_write_point = "$board[bo_write_point]", bo_write_point = '{$board['bo_write_point']}',
bo_comment_point = "$board[bo_comment_point]", bo_comment_point = '{$board['bo_comment_point']}',
bo_download_point = "$board[bo_download_point]", bo_download_point = '{$board['bo_download_point']}',
bo_use_category = "$board[bo_use_category]", bo_use_category = '{$board['bo_use_category']}',
bo_category_list = "$board[bo_category_list]", bo_category_list = '{$board['bo_category_list']}',
bo_disable_tags = "$board[bo_disable_tags]", bo_disable_tags = '{$board['bo_disable_tags']}',
bo_use_secret = "$board[bo_use_secret]", bo_use_secret = '{$board['bo_use_secret']}',
bo_use_dhtml_editor = "$board[bo_use_dhtml_editor]", bo_use_dhtml_editor = '{$board['bo_use_dhtml_editor']}',
bo_use_sideview = "$board[bo_use_sideview]", bo_use_sideview = '{$board['bo_use_sideview']}',
bo_use_comment = "$board[bo_use_comment]", bo_use_comment = '{$board['bo_use_comment']}',
bo_use_good = "$board[bo_use_good]", bo_use_good = '{$board['bo_use_good']}',
bo_use_nogood = "$board[bo_use_nogood]", bo_use_nogood = '{$board['bo_use_nogood']}',
bo_use_signature = "$board[bo_use_signature]", bo_use_signature = '{$board['bo_use_signature']}',
bo_use_ip_view = "$board[bo_use_ip_view]", bo_use_ip_view = '{$board['bo_use_ip_view']}',
bo_use_trackback = "$board[bo_use_trackback]", bo_use_trackback = '{$board['bo_use_trackback']}',
bo_use_list_view = "$board[bo_use_list_view]", bo_use_list_view = '{$board['o_use_list_view']}',
bo_use_list_content = "$board[bo_use_list_content]", bo_use_list_content = '{$board['bo_use_list_content']}',
bo_table_width = "$board[bo_table_width]", bo_table_width = '{$board['bo_table_width']}',
bo_subject_len = "$board[bo_subject_len]", bo_subject_len = '{$board['bo_subject_len']}',
bo_page_rows = "$board[bo_page_rows]", bo_page_rows = '{$board['bo_page_rows']}',
bo_new = "$board[bo_new]", bo_new = '{$board['bo_new']}',
bo_hot = "$board[bo_hot]", bo_hot = '{$board['bo_hot']',
bo_image_width = "$board[bo_image_width]", bo_image_width = '{$board['bo_image_width']',
bo_skin = "$board[bo_skin]", bo_skin = '{$board['bo_skin']}',
bo_include_head = "$board[bo_include_head]", bo_include_head = '{$board['bo_include_head']}',
bo_include_tail = "$board[bo_include_tail]", bo_include_tail = '{$board['bo_include_tail']}',
bo_content_head = '".addslashes($board["bo_content_head"]).'", bo_content_head = '".addslashes($board['bo_content_head'])."',
bo_content_tail = '".addslashes($board["bo_content_tail"]).'", bo_content_tail = '".addslashes($board['bo_content_tail'])."',
bo_insert_content = '".addslashes($board["bo_insert_content"]).'", bo_insert_content = '".addslashes($board['bo_insert_content'])."',
bo_gallery_cols = "$board[bo_gallery_cols]", bo_gallery_cols = '{$board['bo_gallery_cols']}',
bo_upload_size = "$board[bo_upload_size]", bo_upload_size = '{$board['bo_upload_size']}',
bo_reply_order = "$board[bo_reply_order]", bo_reply_order = '{$board['bo_reply_order']}',
bo_use_search = "$board[bo_use_search]", bo_use_search = '{$board['bo_use_search']}',
bo_order_search = "$board[bo_order_search]", bo_order_search = '{$board['bo_order_search']}',
bo_notice = "$board[bo_notice]", bo_notice = '{$board['bo_notice']}',
bo_upload_count = "$board[bo_upload_count]", bo_upload_count = '{$board['bo_upload_count']}',
bo_use_email = "$board[bo_use_email]", bo_use_email = '{$board['bo_use_email']}',
bo_sort_field = "$board[bo_sort_field]", bo_sort_field = '{$board['bo_sort_field']}',
bo_1_subj = "$board[bo_1_subj]", bo_1_subj = '{$board['bo_1_subj']}',
bo_2_subj = "$board[bo_2_subj]", bo_2_subj = '{$board['bo_2_subj']}',
bo_3_subj = "$board[bo_3_subj]", bo_3_subj = '{$board['bo_3_subj']}',
bo_4_subj = "$board[bo_4_subj]", bo_4_subj = '{$board['bo_4_subj']}',
bo_5_subj = "$board[bo_5_subj]", bo_5_subj = '{$board['bo_5_subj']}',
bo_6_subj = "$board[bo_6_subj]", bo_6_subj = '{$board['bo_6_subj']}',
bo_7_subj = "$board[bo_7_subj]", bo_7_subj = '{$board['bo_7_subj']}',
bo_8_subj = "$board[bo_8_subj]", bo_8_subj = '{$board['bo_8_subj']}',
bo_9_subj = "$board[bo_9_subj]", bo_9_subj = '{$board['bo_9_subj']}',
bo_10_subj = "$board[bo_10_subj]", bo_10_subj = '{$board['bo_10_subj']}',
bo_1 = "$board[bo_1]", bo_1 = '{$board['bo_1']}',
bo_2 = "$board[bo_2]", bo_2 = '{$board['bo_2']}',
bo_3 = "$board[bo_3]", bo_3 = '{$board['bo_3']}',
bo_4 = "$board[bo_4]", bo_4 = '{$board['bo_4']}',
bo_5 = "$board[bo_5]", bo_5 = '{$board['bo_5']}',
bo_6 = "$board[bo_6]", bo_6 = '{$board['bo_6']',
bo_7 = "$board[bo_7]", bo_7 = '{$board['bo_7']}',
bo_8 = "$board[bo_8]", bo_8 = '{$board['bo_8']}',
bo_9 = "$board[bo_9]", bo_9 = '{$board['bo_9']}',
bo_10 = "$board[bo_10]" '; bo_10 = '{$board['bo_10']}' ";
sql_query($sql); sql_query($sql);
// 게시판 폴더 생성 // 게시판 폴더 생성
@mkdir('$g4['path']/data/file/$target_table', 0707); @mkdir($g4['path'].'/data/file/'.$target_table, 0707);
@chmod('$g4['path']/data/file/$target_table', 0707); @chmod($g4['path'].'/data/file/'.$target_table, 0707);
// 디렉토리에 있는 파일의 목록을 보이지 않게 한다. // 디렉토리에 있는 파일의 목록을 보이지 않게 한다.
$board_path = '$g4['path']/data/file/$target_table'; $board_path = $g4['path'].'/data/file/'.$target_table;
$file = $board_path . '/index.php'; $file = $board_path . '/index.php';
$f = @fopen($file, 'w'); $f = @fopen($file, 'w');
@fwrite($f, ''); @fwrite($f, '');
@ -117,10 +117,10 @@ $f = @fopen($file, 'w');
@chmod($file, 0606); @chmod($file, 0606);
$copy_file = 0; $copy_file = 0;
if ($copy_case == 'schema_data_both') if ($copy_case == 'schema_data_both')
{ {
$d = dir('$g4['path']/data/file/$bo_table'); $d = dir($g4['path'].'/data/file/'.$bo_table);
while ($entry = $d->read()) while ($entry = $d->read())
{ {
if ($entry == '.' || $entry == '..') continue; if ($entry == '.' || $entry == '..') continue;
@ -132,34 +132,34 @@ if ($copy_case == 'schema_data_both')
*/ */
// 김선용 201007 : // 김선용 201007 :
if(is_dir('$g4['path']/data/file/$bo_table/$entry')){ if(is_dir($g4['path'].'/data/file/'.$bo_table.'/'.$entry)){
$dd = dir('$g4['path']/data/file/$bo_table/$entry'); $dd = dir($g4['path'].'/data/file/'.$bo_table.'/'.$entry);
@mkdir('$g4['path']/data/file/$target_table/$entry', 0707); @mkdir($g4['path'].'/data/file/'.$target_table.'/'.$entry, 0707);
@chmod('$g4['path']/data/file/$target_table/$entry', 0707); @chmod('$g4['path']/data/file/$target_table/$entry', 0707);
while ($entry2 = $dd->read()) { while ($entry2 = $dd->read()) {
if ($entry2 == '.' || $entry2 == '..') continue; if ($entry2 == '.' || $entry2 == '..') continue;
@copy('$g4['path']/data/file/$bo_table/$entry/$entry2', '$g4['path']/data/file/$target_table/$entry/$entry2'); @copy($g4['path'].'/data/file/'.$bo_table.'/'.$entry.'/'.$entry2, $g4['path'].'/data/file/'.$target_table.'/'.$entry.'/'.$entry2);
@chmod('$g4['path']/data/file/$target_table/$entry/$entry2', 0707); @chmod($g4['path'].'/data/file/'.$target_table.'/'.$entry.'/'.$entry2, 0707);
$copy_file++; $copy_file++;
} }
$dd->close(); $dd->close();
} }
else { else {
@copy('$g4['path']/data/file/$bo_table/$entry', '$g4['path']/data/file/$target_table/$entry'); @copy($g4['path'].'/data/file/'.$bo_table.'/'.$entry, $g4['path'].'/data/file/'.$target_table.'/'.$entry);
@chmod('$g4['path']/data/file/$target_table/$entry', 0707); @chmod($g4['path'].'/data/file/'.$target_table.'/'.$entry, 0707);
$copy_file++; $copy_file++;
} }
} }
$d->close(); $d->close();
// 글복사 // 글복사
$sql = ' insert into $g4[write_prefix]$target_table select * from $g4[write_prefix]$bo_table '; $sql = " insert into {$g4['write_prefix']}$target_table select * from {$g4['write_prefix']}$bo_table ";
sql_query($sql); sql_query($sql);
// 게시글수 저장 // 게시글수 저장
$sql = ' select bo_count_write, bo_count_comment from $g4[board_table] where bo_table = "$bo_table" '; $sql = " select bo_count_write, bo_count_comment from {$g4['board_table']} where bo_table = '$bo_table' ";
$row = sql_fetch($sql); $row = sql_fetch($sql);
$sql = ' update $g4[board_table] set bo_count_write = "$row[bo_count_write]", bo_count_comment = "$row[bo_count_comment]" where bo_table = "$target_table" '; $sql = " update {$g4['board_table']} set bo_count_write = '{$row['bo_count_write']}', bo_count_comment = '{$row['bo_count_comment']}' where bo_table = '$target_table' ";
sql_query($sql); sql_query($sql);
// 05.05.24 // 05.05.24
@ -169,41 +169,41 @@ if ($copy_case == 'schema_data_both')
// 4.00.01 // 4.00.01
// 위의 코드는 같은 테이블명을 사용하였다는 오류가 발생함. (희한하네 ㅡㅡ;) // 위의 코드는 같은 테이블명을 사용하였다는 오류가 발생함. (희한하네 ㅡㅡ;)
$sql = ' select * from $g4[board_file_table] where bo_table = "$bo_table" '; $sql = " select * from {$g4['board_file_table']} where bo_table = '$bo_table' ";
$result = sql_query($sql); $result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) for ($i=0; $row=sql_fetch_array($result); $i++)
$file_copy[$i] = $row; $file_copy[$i] = $row;
} }
if (count($file_copy)) if (count($file_copy))
{ {
for ($i=0; $i<count($file_copy); $i++) for ($i=0; $i<count($file_copy); $i++)
{ {
$sql = ' insert into $g4[board_file_table] $sql = " insert into $g4[board_file_table]
set bo_table = "$target_table", set bo_table = '$target_table',
wr_id = "{$file_copy[$i][wr_id]}", wr_id = '{$file_copy[$i]['wr_id']}',
bf_no = "{$file_copy[$i][bf_no]}", bf_no = '{$file_copy[$i]['bf_no']}',
bf_source = "{$file_copy[$i][bf_source]}", bf_source = '{$file_copy[$i]['bf_source']}',
bf_file = "{$file_copy[$i][bf_file]}", bf_file = '{$file_copy[$i]['bf_file']}',
bf_download = "{$file_copy[$i][bf_download]}", bf_download = '{$file_copy[$i]['bf_download']}',
bf_content = "{$file_copy[$i][bf_content]}", bf_content = '{$file_copy[$i]['bf_content']}',
bf_filesize = "{$file_copy[$i][bf_filesize]}", bf_filesize = '{$file_copy[$i]['bf_filesize']}',
bf_width = "{$file_copy[$i][bf_width]}", bf_width = '{$file_copy[$i]['bf_width']}',
bf_height = "{$file_copy[$i][bf_height]}", bf_height = '{$file_copy[$i]['bf_height']}',
bf_type = "{$file_copy[$i][bf_type]}", bf_type = '{$file_copy[$i]['bf_type']}',
bf_datetime = "{$file_copy[$i][bf_datetime]}" '; bf_datetime = '{$file_copy[$i]['bf_datetime']}' ";
sql_query($sql, FALSE); sql_query($sql, FALSE);
} }
} }
echo '<meta http-equiv="content-type" content="text/html; charset={$g4["charset"]}">'; echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=$g4['charset']\">";
echo '<script type="text/javascript">'; echo "<script type=\"text/javascript\">";
echo 'alert('게시판 복사 : {$bo_table} -> {$target_table}'; echo "alert('게시판 복사 : {$bo_table} -> {$target_table}";
if ($copy_file) if ($copy_file)
echo '\\n\\n복사한 파일 : {$copy_file}'; echo "\\n\\n복사한 파일 : 총 {$copy_file}";
echo '');'; echo ");";
echo 'opener.document.location.reload();'; echo "opener.document.location.reload();";
echo '</script>'; echo "</script>";
goto_url('./board_copy.php?bo_table=$bo_table&$qstr'); goto_url('./board_copy.php?bo_table='.$bo_table.'&amp'.$qstr');
?> ?>

View File

@ -23,6 +23,8 @@ $g4['title'] = '환경설정';
include_once ('./admin.head.php'); include_once ('./admin.head.php');
?> ?>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<form id="fconfigform" name="fconfigform" method="post" onsubmit="return fconfigform_submit(this);"> <form id="fconfigform" name="fconfigform" method="post" onsubmit="return fconfigform_submit(this);">
<input type="hidden" id="token" name="token" value="<?=$token?>"> <input type="hidden" id="token" name="token" value="<?=$token?>">
@ -148,7 +150,7 @@ include_once ('./admin.head.php');
</tr> </tr>
<tr> <tr>
<th scope="row" id="th205"><label for="cf_link_target">LINK TARGET</label></th> <th scope="row" id="th205"><label for="cf_link_target">LINK TARGET</label></th>
<td headers="th205"><input type="text" id="cf_link_target" name="cf_link_target" value="<?=$config[cf_link_target]?>"> <td headers="th205"><input type="text" id="cf_link_target" name="cf_link_target" value="<?=$config[cf_link_target]?>">
<?=help("게시판 내용중 자동으로 링크되는 창의 타켓을 지정합니다.\n\n_self, _top, _blank, _new 를 주로 지정합니다.")?></td> <?=help("게시판 내용중 자동으로 링크되는 창의 타켓을 지정합니다.\n\n_self, _top, _blank, _new 를 주로 지정합니다.")?></td>
<th scope="row" id="th206"><label for="cf_search_part">검색 단위</label></th> <th scope="row" id="th206"><label for="cf_search_part">검색 단위</label></th>
<td headers="th206"><input type="text" id="cf_search_part" name="cf_search_part" value="<?=$config[cf_search_part]?>"> 건 단위로 검색</td> <td headers="th206"><input type="text" id="cf_search_part" name="cf_search_part" value="<?=$config[cf_search_part]?>"> 건 단위로 검색</td>
@ -393,13 +395,16 @@ include_once ('./admin.head.php');
<legend><span></span>XSS 혹은 CSRF 방지</legend> <legend><span></span>XSS 혹은 CSRF 방지</legend>
<p>관리자 권한을 탈취당하는 경우를 대비하여 패스워드를 다시 한번 확인합니다.</p> <p>관리자 권한을 탈취당하는 경우를 대비하여 패스워드를 다시 한번 확인합니다.</p>
<label for="admin_password">관리자 패스워드</label> <label for="admin_password">관리자 패스워드</label>
<input type="password" id="admin_password" name="admin_password" required> <input type="password" id="admin_password" name="admin_password" required title="관리자 패스워드">
<input type="submit" accesskey="s" value="확인"> <input type="submit" accesskey="s" value="확인">
</fieldset> </fieldset>
</form> </form>
<script> <script>
$(function() {
$( document ).tooltip();
});
function fconfigform_submit(f) function fconfigform_submit(f)
{ {
f.action = "./config_form_update.php"; f.action = "./config_form_update.php";

View File

@ -2,8 +2,8 @@
/******************************************************************************* /*******************************************************************************
** 공통 변수, 상수, 코드 ** 공통 변수, 상수, 코드
*******************************************************************************/ *******************************************************************************/
error_reporting(E_ALL); //error_reporting(E_ALL);
//error_reporting(E_ALL ^ E_NOTICE); error_reporting(E_ALL ^ E_NOTICE);
// 보안설정이나 프레임이 달라도 쿠키가 통하도록 설정 // 보안설정이나 프레임이 달라도 쿠키가 통하도록 설정
header('P3P: CP="ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC"'); header('P3P: CP="ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC"');
@ -103,48 +103,48 @@ if ($_GET['g4_path'] || $_POST['g4_path'] || $_COOKIE['g4_path']) {
//========================================================================================================================== //==========================================================================================================================
// XSS(Cross Site Scripting) 공격에 의한 데이터 검증 및 차단 // XSS(Cross Site Scripting) 공격에 의한 데이터 검증 및 차단
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
function xss_clean($data) function xss_clean($data)
{ {
// If its empty there is no point cleaning it :\ // If its empty there is no point cleaning it :\
if(empty($data)) if(empty($data))
return $data; return $data;
// Recursive loop for arrays // Recursive loop for arrays
if(is_array($data)) if(is_array($data))
{ {
foreach($data as $key => $value) foreach($data as $key => $value)
{ {
$data[$key] = xss_clean($value); $data[$key] = xss_clean($value);
} }
return $data; return $data;
} }
// http://svn.bitflux.ch/repos/public/popoon/trunk/classes/externalinput.php // http://svn.bitflux.ch/repos/public/popoon/trunk/classes/externalinput.php
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | Copyright (c) 2001-2006 Bitflux GmbH | // | Copyright (c) 2001-2006 Bitflux GmbH |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | Licensed under the Apache License, Version 2.0 (the "License"); | // | Licensed under the Apache License, Version 2.0 (the "License"); |
// | you may not use this file except in compliance with the License. | // | you may not use this file except in compliance with the License. |
// | You may obtain a copy of the License at | // | You may obtain a copy of the License at |
// | http://www.apache.org/licenses/LICENSE-2.0 | // | http://www.apache.org/licenses/LICENSE-2.0 |
// | Unless required by applicable law or agreed to in writing, software | // | Unless required by applicable law or agreed to in writing, software |
// | distributed under the License is distributed on an "AS IS" BASIS, | // | distributed under the License is distributed on an "AS IS" BASIS, |
// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | // | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
// | implied. See the License for the specific language governing | // | implied. See the License for the specific language governing |
// | permissions and limitations under the License. | // | permissions and limitations under the License. |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | Author: Christian Stocker <chregu@bitflux.ch> | // | Author: Christian Stocker <chregu@bitflux.ch> |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// Fix &entity\n; // Fix &entity\n;
$data = str_replace(array('&amp;','&lt;','&gt;'), array('&amp;amp;','&amp;lt;','&amp;gt;'), $data); $data = str_replace(array('&amp;','&lt;','&gt;'), array('&amp;amp;','&amp;lt;','&amp;gt;'), $data);
$data = preg_replace('/(&#*\w+)[\x00-\x20]+;/', '$1;', $data); $data = preg_replace('/(&#*\w+)[\x00-\x20]+;/', '$1;', $data);
$data = preg_replace('/(&#x*[0-9A-F]+);*/i', '$1;', $data); $data = preg_replace('/(&#x*[0-9A-F]+);*/i', '$1;', $data);
if (function_exists("html_entity_decode")) if (function_exists("html_entity_decode"))
{ {
$data = html_entity_decode($data); $data = html_entity_decode($data);
} }
else else
{ {
@ -153,32 +153,32 @@ function xss_clean($data)
$data = strtr($data, $trans_tbl); $data = strtr($data, $trans_tbl);
} }
// Remove any attribute starting with "on" or xmlns // Remove any attribute starting with "on" or xmlns
$data = preg_replace('#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#i', '$1>', $data); $data = preg_replace('#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#i', '$1>', $data);
// Remove javascript: and vbscript: protocols // Remove javascript: and vbscript: protocols
$data = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`\'"]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#i', '$1=$2nojavascript...', $data); $data = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`\'"]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#i', '$1=$2nojavascript...', $data);
$data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#i', '$1=$2novbscript...', $data); $data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#i', '$1=$2novbscript...', $data);
$data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#', '$1=$2nomozbinding...', $data); $data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#', '$1=$2nomozbinding...', $data);
// Only works in IE: <span style="width: expression(alert('Ping!'));"></span> // Only works in IE: <span style="width: expression(alert('Ping!'));"></span>
$data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?expression[\x00-\x20]*\([^>]*+>#i', '$1>', $data); $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?expression[\x00-\x20]*\([^>]*+>#i', '$1>', $data);
$data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?behaviour[\x00-\x20]*\([^>]*+>#i', '$1>', $data); $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?behaviour[\x00-\x20]*\([^>]*+>#i', '$1>', $data);
$data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*+>#i', '$1>', $data); $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*+>#i', '$1>', $data);
// Remove namespaced elements (we do not need them) // Remove namespaced elements (we do not need them)
$data = preg_replace('#</*\w+:\w[^>]*+>#i', '', $data); $data = preg_replace('#</*\w+:\w[^>]*+>#i', '', $data);
do do
{ {
// Remove really unwanted tags // Remove really unwanted tags
$old_data = $data; $old_data = $data;
$data = preg_replace('#</*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|i(?:frame|layer)|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|title|xml)[^>]*+>#i', '', $data); $data = preg_replace('#</*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|i(?:frame|layer)|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|title|xml)[^>]*+>#i', '', $data);
} }
while ($old_data !== $data); while ($old_data !== $data);
return $data; return $data;
} }
$_GET = xss_clean($_GET); $_GET = xss_clean($_GET);
//========================================================================================================================== //==========================================================================================================================

View File

@ -1,6 +1,6 @@
<? <?
// 이 파일은 새로운 파일 생성시 반드시 포함되어야 함 // 이 파일은 새로운 파일 생성시 반드시 포함되어야 함
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$begin_time = get_microtime(); $begin_time = get_microtime();

View File

@ -7,11 +7,11 @@ if (typeof(WREST_JS) == 'undefined') // 한번만 실행
var wrestMsg = ''; var wrestMsg = '';
var wrestFld = null; var wrestFld = null;
//var wrestFldDefaultColor = '#FFFFFF'; //var wrestFldDefaultColor = '#FFFFFF';
var wrestFldDefaultColor = ''; var wrestFldDefaultColor = '';
var wrestFldBackColor = '#FFE4E1'; var wrestFldBackColor = '#FFE4E1';
var arrAttr = new Array ('required', 'trim', 'minlength', 'email', 'hangul', 'hangul2', var arrAttr = new Array ('required', 'trim', 'minlength', 'email', 'hangul', 'hangul2',
'memberid', 'nospace', 'numeric', 'alpha', 'alphanumeric', 'memberid', 'nospace', 'numeric', 'alpha', 'alphanumeric',
'jumin', 'saupja', 'alphanumericunderline', 'telnumber', 'hangulalphanumeric'); 'jumin', 'saupja', 'alphanumericunderline', 'telnumber', 'hangulalphanumeric');
// subject 속성값을 얻어 return, 없으면 tag의 name을 넘김 // subject 속성값을 얻어 return, 없으면 tag의 name을 넘김
@ -39,7 +39,7 @@ if (typeof(WREST_JS) == 'undefined') // 한번만 실행
} }
// 양쪽 공백 없애기 // 양쪽 공백 없애기
function wrestTrim(fld) function wrestTrim(fld)
{ {
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자 var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자
fld.value = fld.value.replace(pattern, ""); fld.value = fld.value.replace(pattern, "");
@ -49,9 +49,9 @@ if (typeof(WREST_JS) == 'undefined') // 한번만 실행
// 필수 입력 검사 // 필수 입력 검사
function wrestRequired(fld) function wrestRequired(fld)
{ {
if (wrestTrim(fld) == "") if (wrestTrim(fld) == "")
{ {
if (wrestFld == null) if (wrestFld == null)
{ {
// 3.30 // 3.30
// 셀렉트박스일 경우에도 필수 선택 검사합니다. // 셀렉트박스일 경우에도 필수 선택 검사합니다.
@ -65,9 +65,9 @@ if (typeof(WREST_JS) == 'undefined') // 한번만 실행
function wrestMinlength(fld) function wrestMinlength(fld)
{ {
var len = fld.getAttribute("minlength"); var len = fld.getAttribute("minlength");
if (fld.value.length < len) if (fld.value.length < len)
{ {
if (wrestFld == null) if (wrestFld == null)
{ {
wrestMsg = wrestItemname(fld) + " : 최소 " + len + "자 이상 입력하세요.\n"; wrestMsg = wrestItemname(fld) + " : 최소 " + len + "자 이상 입력하세요.\n";
wrestFld = fld; wrestFld = fld;
@ -81,7 +81,7 @@ if (typeof(WREST_JS) == 'undefined') // 한번만 실행
if (!wrestTrim(fld)) return; if (!wrestTrim(fld)) return;
var pattern = /^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}$/; var pattern = /^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}$/;
if(!pattern.test(fld.value)){ if(!pattern.test(fld.value)){
if(wrestFld == null){ if(wrestFld == null){
wrestMsg = wrestItemname(fld)+" : 전화번호 형식이 올바르지 않습니다.\n\n하이픈(-)을 포함하여 입력해 주십시오.\n"; wrestMsg = wrestItemname(fld)+" : 전화번호 형식이 올바르지 않습니다.\n\n하이픈(-)을 포함하여 입력해 주십시오.\n";
wrestFld = fld; wrestFld = fld;
@ -91,15 +91,15 @@ if (typeof(WREST_JS) == 'undefined') // 한번만 실행
} }
// 이메일주소 형식 검사 // 이메일주소 형식 검사
function wrestEmail(fld) function wrestEmail(fld)
{ {
if (!wrestTrim(fld)) return; if (!wrestTrim(fld)) return;
//var pattern = /(\S+)@(\S+)\.(\S+)/; 이메일주소에 한글 사용시 //var pattern = /(\S+)@(\S+)\.(\S+)/; 이메일주소에 한글 사용시
var pattern = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/; var pattern = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/;
if (!pattern.test(fld.value)) if (!pattern.test(fld.value))
{ {
if (wrestFld == null) if (wrestFld == null)
{ {
wrestMsg = wrestItemname(fld) + " : 이메일주소 형식이 아닙니다.\n"; wrestMsg = wrestItemname(fld) + " : 이메일주소 형식이 아닙니다.\n";
wrestFld = fld; wrestFld = fld;
@ -108,14 +108,14 @@ if (typeof(WREST_JS) == 'undefined') // 한번만 실행
} }
// 회원아이디 검사 // 회원아이디 검사
function wrestMemberId(fld) function wrestMemberId(fld)
{ {
if (!wrestTrim(fld)) return; if (!wrestTrim(fld)) return;
var pattern = /(^([a-z0-9]+)([a-z0-9_]+$))/; var pattern = /(^([a-z0-9]+)([a-z0-9_]+$))/;
if (!pattern.test(fld.value)) if (!pattern.test(fld.value))
{ {
if (wrestFld == null) if (wrestFld == null)
{ {
wrestMsg = wrestItemname(fld) + " : 회원아이디 형식이 아닙니다.\n\n영소문자, 숫자, _ 만 가능.\n\n첫글자는 영소문자, 숫자만 가능\n"; wrestMsg = wrestItemname(fld) + " : 회원아이디 형식이 아닙니다.\n\n영소문자, 숫자, _ 만 가능.\n\n첫글자는 영소문자, 숫자만 가능\n";
wrestFld = fld; wrestFld = fld;
@ -124,137 +124,137 @@ if (typeof(WREST_JS) == 'undefined') // 한번만 실행
} }
// 한글인지 검사 (자음, 모음만 있는 한글은 불가) // 한글인지 검사 (자음, 모음만 있는 한글은 불가)
function wrestHangul(fld) function wrestHangul(fld)
{ {
if (!wrestTrim(fld)) return; if (!wrestTrim(fld)) return;
var pattern = /([^가-힣\x20])/i; var pattern = /([^가-힣\x20])/i;
if (pattern.test(fld.value)) if (pattern.test(fld.value))
{ {
if (wrestFld == null) if (wrestFld == null)
{ {
wrestMsg = wrestItemname(fld) + ' : 한글이 아닙니다. (자음, 모음만 있는 한글은 처리하지 않습니다.)\n'; wrestMsg = wrestItemname(fld) + ' : 한글이 아닙니다. (자음, 모음만 있는 한글은 처리하지 않습니다.)\n';
wrestFld = fld; wrestFld = fld;
} }
} }
} }
// 한글인지 검사2 (자음, 모음만 있는 한글도 가능) // 한글인지 검사2 (자음, 모음만 있는 한글도 가능)
function wrestHangul2(fld) function wrestHangul2(fld)
{ {
if (!wrestTrim(fld)) return; if (!wrestTrim(fld)) return;
var pattern = /([^가-힣ㄱ-ㅎㅏ-ㅣ\x20])/i; var pattern = /([^가-힣ㄱ-ㅎㅏ-ㅣ\x20])/i;
if (pattern.test(fld.value)) if (pattern.test(fld.value))
{ {
if (wrestFld == null) if (wrestFld == null)
{ {
wrestMsg = wrestItemname(fld) + ' : 한글이 아닙니다.\n'; wrestMsg = wrestItemname(fld) + ' : 한글이 아닙니다.\n';
wrestFld = fld; wrestFld = fld;
} }
} }
} }
// 한글,영문,숫자인지 검사3 // 한글,영문,숫자인지 검사3
function wrestHangulAlphaNumeric(fld) function wrestHangulAlphaNumeric(fld)
{ {
if (!wrestTrim(fld)) return; if (!wrestTrim(fld)) return;
var pattern = /([^가-힣\x20^a-z^A-Z^0-9])/i; var pattern = /([^가-힣\x20^a-z^A-Z^0-9])/i;
if (pattern.test(fld.value)) if (pattern.test(fld.value))
{ {
if (wrestFld == null) if (wrestFld == null)
{ {
wrestMsg = wrestItemname(fld) + ' : 한글, 영문, 숫자가 아닙니다.\n'; wrestMsg = wrestItemname(fld) + ' : 한글, 영문, 숫자가 아닙니다.\n';
wrestFld = fld; wrestFld = fld;
} }
} }
} }
// 숫자인지검사 // 숫자인지검사
// 배부른꿀꿀이님 추가 (http://dasir.com) 2003-06-24 // 배부른꿀꿀이님 추가 (http://dasir.com) 2003-06-24
function wrestNumeric(fld) function wrestNumeric(fld)
{ {
if (fld.value.length > 0) if (fld.value.length > 0)
{ {
for (i = 0; i < fld.value.length; i++) for (i = 0; i < fld.value.length; i++)
{ {
if (fld.value.charAt(i) < '0' || fld.value.charAt(i) > '9') if (fld.value.charAt(i) < '0' || fld.value.charAt(i) > '9')
{ {
wrestMsg = wrestItemname(fld) + " : 숫자가 아닙니다.\n"; wrestMsg = wrestItemname(fld) + " : 숫자가 아닙니다.\n";
wrestFld = fld; wrestFld = fld;
} }
} }
} }
} }
// 영문자 검사 // 영문자 검사
// 배부른꿀꿀이님 추가 (http://dasir.com) 2003-06-24 // 배부른꿀꿀이님 추가 (http://dasir.com) 2003-06-24
function wrestAlpha(fld) function wrestAlpha(fld)
{ {
if (!wrestTrim(fld)) return; if (!wrestTrim(fld)) return;
var pattern = /(^[a-zA-Z]+$)/; var pattern = /(^[a-zA-Z]+$)/;
if (!pattern.test(fld.value)) if (!pattern.test(fld.value))
{ {
if (wrestFld == null) if (wrestFld == null)
{ {
wrestMsg = wrestItemname(fld) + " : 영문이 아닙니다.\n"; wrestMsg = wrestItemname(fld) + " : 영문이 아닙니다.\n";
wrestFld = fld; wrestFld = fld;
} }
} }
} }
// 영문자와 숫자 검사 // 영문자와 숫자 검사
// 배부른꿀꿀이님 추가 (http://dasir.com) 2003-07-07 // 배부른꿀꿀이님 추가 (http://dasir.com) 2003-07-07
function wrestAlphaNumeric(fld) function wrestAlphaNumeric(fld)
{ {
if (!wrestTrim(fld)) return; if (!wrestTrim(fld)) return;
var pattern = /(^[a-zA-Z0-9]+$)/; var pattern = /(^[a-zA-Z0-9]+$)/;
if (!pattern.test(fld.value)) if (!pattern.test(fld.value))
{ {
if (wrestFld == null) if (wrestFld == null)
{ {
wrestMsg = wrestItemname(fld) + " : 영문 또는 숫자가 아닙니다.\n"; wrestMsg = wrestItemname(fld) + " : 영문 또는 숫자가 아닙니다.\n";
wrestFld = fld; wrestFld = fld;
} }
} }
} }
// 영문자와 숫자 그리고 _ 검사 // 영문자와 숫자 그리고 _ 검사
function wrestAlphaNumericUnderLine(fld) function wrestAlphaNumericUnderLine(fld)
{ {
if (!wrestTrim(fld)) if (!wrestTrim(fld))
return; return;
var pattern = /(^[a-zA-Z0-9\_]+$)/; var pattern = /(^[a-zA-Z0-9\_]+$)/;
if (!pattern.test(fld.value)) if (!pattern.test(fld.value))
{ {
if (wrestFld == null) if (wrestFld == null)
{ {
wrestMsg = wrestItemname(fld) + " : 영문, 숫자, _ 가 아닙니다.\n"; wrestMsg = wrestItemname(fld) + " : 영문, 숫자, _ 가 아닙니다.\n";
wrestFld = fld; wrestFld = fld;
} }
} }
} }
// 주민등록번호 검사 // 주민등록번호 검사
function wrestJumin(fld) function wrestJumin(fld)
{ {
if (!wrestTrim(fld)) return; if (!wrestTrim(fld)) return;
var pattern = /(^[0-9]{13}$)/; var pattern = /(^[0-9]{13}$)/;
if (!pattern.test(fld.value)) if (!pattern.test(fld.value))
{ {
if (wrestFld == null) if (wrestFld == null)
{ {
wrestMsg = wrestItemname(fld) + " : 주민등록번호를 13자리 숫자로 입력하십시오.\n"; wrestMsg = wrestItemname(fld) + " : 주민등록번호를 13자리 숫자로 입력하십시오.\n";
wrestFld = fld; wrestFld = fld;
} }
} }
else else
{ {
var sum_1 = 0; var sum_1 = 0;
var sum_2 = 0; var sum_2 = 0;
@ -274,47 +274,47 @@ if (typeof(WREST_JS) == 'undefined') // 한번만 실행
(juminno.charAt(11)*5); (juminno.charAt(11)*5);
sum_2=sum_1 % 11; sum_2=sum_1 % 11;
if (sum_2 == 0) if (sum_2 == 0)
at = 10; at = 10;
else else
{ {
if (sum_2 == 1) if (sum_2 == 1)
at = 11; at = 11;
else else
at = sum_2; at = sum_2;
} }
att = 11 - at; att = 11 - at;
// 1800 년대에 태어나신 분들은 남자, 여자의 구분이 9, 0 이라는 // 1800 년대에 태어나신 분들은 남자, 여자의 구분이 9, 0 이라는
// 얘기를 들은적이 있는데 그렇다면 아래의 구문은 오류이다. // 얘기를 들은적이 있는데 그렇다면 아래의 구문은 오류이다.
// 하지만... 100살넘은 분들이 주민등록번호를 과연 입력해볼까? // 하지만... 100살넘은 분들이 주민등록번호를 과연 입력해볼까?
if (juminno.charAt(12) != att || if (juminno.charAt(12) != att ||
juminno.substr(2,2) < '01' || juminno.substr(2,2) < '01' ||
juminno.substr(2,2) > '12' || juminno.substr(2,2) > '12' ||
juminno.substr(4,2) < '01' || juminno.substr(4,2) < '01' ||
juminno.substr(4,2) > '31' || juminno.substr(4,2) > '31' ||
juminno.charAt(6) > 4) juminno.charAt(6) > 4)
{ {
wrestMsg = wrestItemname(fld) + " : 올바른 주민등록번호가 아닙니다.\n"; wrestMsg = wrestItemname(fld) + " : 올바른 주민등록번호가 아닙니다.\n";
wrestFld = fld; wrestFld = fld;
} }
} }
} }
// 사업자등록번호 검사 // 사업자등록번호 검사
function wrestSaupja(fld) function wrestSaupja(fld)
{ {
if (!wrestTrim(fld)) return; if (!wrestTrim(fld)) return;
var pattern = /(^[0-9]{10}$)/; var pattern = /(^[0-9]{10}$)/;
if (!pattern.test(fld.value)) if (!pattern.test(fld.value))
{ {
if (wrestFld == null) if (wrestFld == null)
{ {
wrestMsg = wrestItemname(fld) + " : 사업자등록번호를 10자리 숫자로 입력하십시오.\n"; wrestMsg = wrestItemname(fld) + " : 사업자등록번호를 10자리 숫자로 입력하십시오.\n";
wrestFld = fld; wrestFld = fld;
} }
} }
else else
{ {
var sum = 0; var sum = 0;
var at = 0; var at = 0;
@ -331,25 +331,25 @@ if (typeof(WREST_JS) == 'undefined') // 한번만 실행
(saupjano.charAt(8)*5); (saupjano.charAt(8)*5);
sum += parseInt((saupjano.charAt(8)*5)/10); sum += parseInt((saupjano.charAt(8)*5)/10);
at = sum % 10; at = sum % 10;
if (at != 0) if (at != 0)
att = 10 - at; att = 10 - at;
if (saupjano.charAt(9) != att) if (saupjano.charAt(9) != att)
{ {
wrestMsg = wrestItemname(fld) + " : 올바른 사업자등록번호가 아닙니다.\n"; wrestMsg = wrestItemname(fld) + " : 올바른 사업자등록번호가 아닙니다.\n";
wrestFld = fld; wrestFld = fld;
} }
} }
} }
// 공백 검사후 공백을 "" 로 변환 // 공백 검사후 공백을 "" 로 변환
function wrestNospace(fld) function wrestNospace(fld)
{ {
var pattern = /(\s)/g; // \s 공백 문자 var pattern = /(\s)/g; // \s 공백 문자
if (pattern.test(fld.value)) if (pattern.test(fld.value))
{ {
if (wrestFld == null) if (wrestFld == null)
{ {
wrestMsg = wrestItemname(fld) + " : 공백이 없어야 합니다.\n"; wrestMsg = wrestItemname(fld) + " : 공백이 없어야 합니다.\n";
wrestFld = fld; wrestFld = fld;
@ -366,22 +366,22 @@ if (typeof(WREST_JS) == 'undefined') // 한번만 실행
var attr = null; var attr = null;
// 해당폼에 대한 요소의 갯수만큼 돌려라 // 해당폼에 대한 요소의 갯수만큼 돌려라
for (var i = 0; i < this.elements.length; i++) for (var i = 0; i < this.elements.length; i++)
{ {
// Input tag 의 type 이 text, file, password 일때만 // Input tag 의 type 이 text, file, password 일때만
// 3.30 // 3.30
// 셀렉트 박스일때도 필수 선택 검사합니다. select-one // 셀렉트 박스일때도 필수 선택 검사합니다. select-one
if (this.elements[i].type == "text" || if (this.elements[i].type == "text" ||
this.elements[i].type == "file" || this.elements[i].type == "file" ||
this.elements[i].type == "password" || this.elements[i].type == "password" ||
this.elements[i].type == "select-one" || this.elements[i].type == "select-one" ||
this.elements[i].type == "textarea") this.elements[i].type == "textarea")
{ {
// 배열의 길이만큼 돌려라 // 배열의 길이만큼 돌려라
for (var j = 0; j < arrAttr.length; j++) for (var j = 0; j < arrAttr.length; j++)
{ {
// 배열에 정의한 속성과 비교해서 속성이 있거나 값이 있다면 // 배열에 정의한 속성과 비교해서 속성이 있거나 값이 있다면
if (this.elements[i].getAttribute(arrAttr[j]) != null) if (this.elements[i].getAttribute(arrAttr[j]) != null)
{ {
/* /*
// 기본 색상으로 돌려놓고 // 기본 색상으로 돌려놓고
@ -389,7 +389,7 @@ if (typeof(WREST_JS) == 'undefined') // 한번만 실행
this.elements[i].style.backgroundColor = wrestFldDefaultColor; this.elements[i].style.backgroundColor = wrestFldDefaultColor;
} }
*/ */
switch (arrAttr[j]) switch (arrAttr[j])
{ {
case "required" : wrestRequired(this.elements[i]); break; case "required" : wrestRequired(this.elements[i]); break;
case "trim" : wrestTrim(this.elements[i]); break; case "trim" : wrestTrim(this.elements[i]); break;
@ -397,18 +397,18 @@ if (typeof(WREST_JS) == 'undefined') // 한번만 실행
case "email" : wrestEmail(this.elements[i]); break; case "email" : wrestEmail(this.elements[i]); break;
case "hangul" : wrestHangul(this.elements[i]); break; case "hangul" : wrestHangul(this.elements[i]); break;
case "hangul2" : wrestHangul2(this.elements[i]); break; case "hangul2" : wrestHangul2(this.elements[i]); break;
case "hangulalphanumeric" case "hangulalphanumeric"
: wrestHangulAlphaNumeric(this.elements[i]); break; : wrestHangulAlphaNumeric(this.elements[i]); break;
case "memberid" : wrestMemberId(this.elements[i]); break; case "memberid" : wrestMemberId(this.elements[i]); break;
case "nospace" : wrestNospace(this.elements[i]); break; case "nospace" : wrestNospace(this.elements[i]); break;
case "numeric" : wrestNumeric(this.elements[i]); break; case "numeric" : wrestNumeric(this.elements[i]); break;
case "alpha" : wrestAlpha(this.elements[i]); break; case "alpha" : wrestAlpha(this.elements[i]); break;
case "alphanumeric" : wrestAlphaNumeric(this.elements[i]); break; case "alphanumeric" : wrestAlphaNumeric(this.elements[i]); break;
case "alphanumericunderline" : case "alphanumericunderline" :
wrestAlphaNumericUnderLine(this.elements[i]); break; wrestAlphaNumericUnderLine(this.elements[i]); break;
case "jumin" : wrestJumin(this.elements[i]); break; case "jumin" : wrestJumin(this.elements[i]); break;
case "saupja" : wrestSaupja(this.elements[i]); break; case "saupja" : wrestSaupja(this.elements[i]); break;
// 김선용 2006.3 - 전화번호 형식 검사 // 김선용 2006.3 - 전화번호 형식 검사
case "telnumber" : wrestTelnumber(this.elements[i]); break; case "telnumber" : wrestTelnumber(this.elements[i]); break;
default : break; default : break;
@ -420,16 +420,16 @@ if (typeof(WREST_JS) == 'undefined') // 한번만 실행
// 필드가 null 이 아니라면 오류메세지 출력후 포커스를 해당 오류 필드로 옮김 // 필드가 null 이 아니라면 오류메세지 출력후 포커스를 해당 오류 필드로 옮김
// 오류 필드는 배경색상을 바꾼다. // 오류 필드는 배경색상을 바꾼다.
if (wrestFld != null) if (wrestFld != null)
{ {
alert(wrestMsg); alert(wrestMsg);
if (wrestFld.style.display != 'none') if (wrestFld.style.display != 'none')
{ {
wrestFld.style.backgroundColor = wrestFldBackColor; wrestFld.style.backgroundColor = wrestFldBackColor;
wrestFld.focus(); wrestFld.focus();
} }
return false; return false;
} }
if (this.oldsubmit && this.oldsubmit() == false) if (this.oldsubmit && this.oldsubmit() == false)
return false; return false;
@ -440,15 +440,15 @@ if (typeof(WREST_JS) == 'undefined') // 한번만 실행
// 초기에 onsubmit을 가로채도록 한다. // 초기에 onsubmit을 가로채도록 한다.
function wrestInitialized() function wrestInitialized()
{ {
for (var i = 0; i < document.forms.length; i++) for (var i = 0; i < document.forms.length; i++)
{ {
// onsubmit 이벤트가 있다면 저장해 놓는다. // onsubmit 이벤트가 있다면 저장해 놓는다.
if (document.forms[i].onsubmit) document.forms[i].oldsubmit = document.forms[i].onsubmit; if (document.forms[i].onsubmit) document.forms[i].oldsubmit = document.forms[i].onsubmit;
document.forms[i].onsubmit = wrestSubmit; document.forms[i].onsubmit = wrestSubmit;
for (var j = 0; j < document.forms[i].elements.length; j++) for (var j = 0; j < document.forms[i].elements.length; j++)
{ {
// 필수 입력일 경우는 * 배경이미지를 준다. // 필수 입력일 경우는 * 배경이미지를 준다.
if (document.forms[i].elements[j].getAttribute("required") != null) if (document.forms[i].elements[j].getAttribute("required") != null)
{ {
//document.forms[i].elements[j].style.backgroundColor = wrestFldDefaultColor; //document.forms[i].elements[j].style.backgroundColor = wrestFldDefaultColor;
//document.forms[i].elements[j].className = "wrest_required"; //document.forms[i].elements[j].className = "wrest_required";