답변 3개
마르스컴퍼니
Expert
1년 전
* /page/sample_write.php
</p>
<p><?php
include_once('../common.php');
include_once(G5_EDITOR_LIB);</p>
<p>if (!$is_member) {
alert('회원만 이용 가능합니다.', G5_BBS_URL.'/login.php');
}</p>
<p>$g5['title'] = '커스텀 글쓰기';
include_once(G5_PATH.'/head.php');</p>
<p>// 게시판 목록 가져오기
$sql = " SELECT bo_table, bo_subject FROM {$g5['board_table']} WHERE bo_use_search = 1 ORDER BY bo_order ";
$result = sql_query($sql);
$board_options = '';
while ($row = sql_fetch_array($result)) {
$board_options .= "<option value='{$row['bo_table']}'>{$row['bo_subject']}</option>";
}</p>
<p>// 글쓰기 권한 체크는 선택된 게시판에 따라 JavaScript에서 처리</p>
<p>// 에디터 설정
$editor_html = editor_html('wr_content', $content, $is_dhtml_editor);
$editor_js = '';
$editor_js .= get_editor_js('wr_content', $is_dhtml_editor);
$editor_js .= chk_editor_js('wr_content', $is_dhtml_editor);</p>
<p>// 파일 업로드 설정
$file_count = (int)$board['bo_upload_count'];
?></p>
<p><section id="bo_w">
<h2 class="sound_only"><?php echo $g5['title'] ?></h2></p>
<p> <form name="fwrite" id="fwrite" action="<?php echo G5_BBS_URL; ?>/write_update.php" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
<input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="page" value="<?php echo $page ?>"></p>
<p> <div class="bo_w_select write_div">
<label for="sel_bo_table">게시판 선택<strong class="sound_only">필수</strong></label>
<select name="sel_bo_table" id="sel_bo_table" required>
<option value="">게시판을 선택하세요</option>
<?php echo $board_options ?>
</select>
</div></p>
<p> <div class="bo_w_info write_div">
<label for="wr_subject" class="sound_only">제목<strong>필수</strong></label>
<input type="text" name="wr_subject" value="<?php echo $subject ?>" id="wr_subject" required class="frm_input full_input required" size="50" maxlength="255" placeholder="제목">
</div></p>
<p> <div class="write_div">
<label for="wr_content" class="sound_only">내용<strong>필수</strong></label>
<div class="wr_content <?php echo $is_dhtml_editor ? $config['cf_editor'] : ''; ?>">
<?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
</div>
</div></p>
<p> <?php for ($i=0; $is_file && $i<$file_count; $i++) { ?>
<div class="bo_w_flie write_div">
<div class="file_wr write_div">
<label for="bf_file_<?php echo $i+1 ?>" class="lb_icon"><i class="fa fa-folder-open" aria-hidden="true"></i><span class="sound_only"> 파일 #<?php echo $i+1 ?></span></label>
<input type="file" name="bf_file[]" id="bf_file_<?php echo $i+1 ?>" title="파일첨부 <?php echo $i+1 ?> : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="frm_file ">
</div>
<?php if ($is_file_content) { ?>
<input type="text" name="bf_content[]" value="<?php echo ($w == 'u') ? $file[$i]['bf_content'] : ''; ?>" title="파일 설명을 입력해주세요." class="full_input frm_input" size="50" placeholder="파일 설명을 입력해주세요.">
<?php } ?>
</div>
<?php } ?></p>
<p> <div class="btn_confirm write_div">
<a href="javascript:history.back();" class="btn_cancel btn">취소</a>
<button type="submit" id="btn_submit" accesskey="s" class="btn_submit btn">작성완료</button>
</div>
</form>
</section></p>
<p><script>
<?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함 ?></p>
<p>function fwrite_submit(f)
{
var sel_bo_table = f.sel_bo_table.value;
if (sel_bo_table == "") {
alert("게시판을 선택해주세요.");
f.sel_bo_table.focus();
return false;
}
f.bo_table.value = sel_bo_table;</p>
<p> <?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함 ?></p>
<p> var subject = "";
var content = "";
$.ajax({
url: g5_bbs_url+"/ajax.filter.php",
type: "POST",
data: {
"subject": f.wr_subject.value,
"content": f.wr_content.value
},
dataType: "json",
async: false,
cache: false,
success: function(data, textStatus) {
subject = data.subject;
content = data.content;
}
});</p>
<p> if (subject) {
alert("제목에 금지단어('"+subject+"')가 포함되어있습니다");
f.wr_subject.focus();
return false;
}</p>
<p> if (content) {
alert("내용에 금지단어('"+content+"')가 포함되어있습니다");
if (typeof(ed_wr_content) != "undefined")
ed_wr_content.returnFocus();
else
f.wr_content.focus();
return false;
}</p>
<p> if (document.getElementById("char_count")) {
if (char_min > 0 || char_max > 0) {
var cnt = parseInt(check_byte("wr_content", "char_count"));
if (char_min > 0 && char_min > cnt) {
alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다.");
return false;
}
else if (char_max > 0 && char_max < cnt) {
alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다.");
return false;
}
}
}</p>
<p> document.getElementById("btn_submit").disabled = "disabled";</p>
<p> return true;
}
</script></p>
<p><?php
include_once(G5_PATH.'/tail.php');
?></p>
<p>
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인