그누보드 [G5] 일반페이지에서 글작성하기
페이지 정보
본문
일반페이지 상담신청을 입력양식을 만든후 그것을 게시판에 저장하는 방법입니다.
1. 상담신청 양식 작성
<?php
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
$captcha_html = '';
$captcha_js = '';
if ($is_guest) {
$captcha_html = captcha_html();
$captcha_js = chk_captcha_js();
}
?>
<script type="text/javascript">
function sms_input_check() {
var f = document.frm; // 본문 form에서의 name 값으로 수정
if(f.wr_name.value == '') {
alert('이름을 입력해 주십시오.');
f.wr_name.focus();
return false;
}
function checkPhone(wr_3) {
var regExp = /^\d{3,4}-\d{3,4}-\d{4}$/;
if(regExp.test(wr_3)) { // test 는 정규 Methods 입니다. test는 변경없음
return true;
} else {
return false;
}
}
if(f.wr_3.value == '') {
alert('연락처를 입력해 주십시오.');
f.wr_3.focus();
return false;
} else {
if(!checkPhone(f.wr_3.value)) {
alert('잘못된 전화번호입니다. 숫자, - 를 포함한 숫자만 입력하세요. 예) 050-XXXX-XXXX');
f.wr_3.focus();
return false;
}
}
/*
function checkEmail(wr_email) {
//var regExp = /^([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)(\.[0-9a-zA-Z_-]+){1,2}$/; // 이메일 체크 ( id1.id2@test.com 대응불가 )
var regExp = /^[-!#$%&'*+./0-9=?A-Z^_a-z{|}~]+@[-!#$%&'*+/0-9=?A-Z^_a-z{|}~]+.[-!#$%&'*+./0-9=?A-Z^_a-z{|}~]+$/;
if(regExp.test(wr_email)) { // test 는 정규 Methods 입니다. test는 변경없음
return true;
} else {
return false;
}
}
if(f.wr_email.value == '') {
alert('이메일 주소를 입력해 주십시오.');
f.wr_email.focus();
return false;
}
else {
if(!checkEmail(f.wr_email.value)) {
alert('이메일 주소를 바르게 입력해 주십시오.');
f.wr_email.focus();
return false;
}
}
*/
if(f.wr_content.value == '') {
alert('상담내용을 입력해 주십시오.');
f.wr_content.focus();
return false;
}
var agree = document.getElementsByName("agree_chk");
if (!agree[0].checked) {
alert("개인정보 수집 및 이용에 동의하셔야 회원가입 하실 수 있습니다.");
agree[0].focus();
return false;
}
<?php echo $captcha_js; // 캡챠 사용시 자바스크립트에서 입력된 캡챠를 검사함 ?>
}
</script>
<form class="tbl_frm03" name="frm" method="post" action="<?php echo G5_URL; ?>/문서_update.php" onSubmit="return sms_input_check(this)">
<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
<input type="hidden" name="w" value="">
<input type="hidden" name="bo_table" value="reservation">
<input type="hidden" name="wr_id" value="0">
<input type="hidden" name="sca" value="">
<input type="hidden" name="sfl" value="">
<input type="hidden" name="stx" value="">
<input type="hidden" name="spt" value="">
<input type="hidden" name="sst" value="">
<input type="hidden" name="sod" value="">
<input type="hidden" name="page" value="">
<input type="hidden" name="secret" value='secret'><!-- 비밀글 -->
<input type="hidden" name="s" accept="" value="s">
<input type="hidden" name="wr_subject" value="빠른 상담 신청">
<input type="hidden" name="wr_key" value="">
<span style="font-size:12px;">개인정보취급방침
<a href="javascript:void(window.open('<?php echo G5_URL; ?>/privacy.php','','width=590,height=300, top=130, left=500 scrollbars=yes'))">[전문보기]</a> :
<input type="radio" name="agree_chk" value="y">동의함
<input type="radio" name="agree_chk" value="n">동의하지 않음
</span>
<ul style="list-style-type: none;">
<li>이<span style="letter-spacing:27px;"> </span>름:<input type="input" name="wr_name" id="wr_name" itemname="이름" style="border:1px solid #e4eaec;background:#f7f7f7; width:144px; height:20px; padding:2px; margin:0px 1px 0px 3px;"></li>
<li>연 락 처:<input type="input" name="wr_3" id="wr_3" value="" style="border:1px solid #e4eaec;background:#f7f7f7; width:144px; height:20px; padding:2px; margin:5px 1px 0px 3px;"></li>
<?php if ($is_guest) { //자동등록방지 ?>
<li>상담내용:<textarea name="wr_content" id="wr_content" itemname="상담내용" style="height:30px; padding:2px; margin:5px 1px 1px 3px;"></textarea></li>
<li>비밀번호:<input type="password" name="wr_password" id="wr_password" <?php echo $password_required; ?> class="frm_input <?php echo $password_required; ?>" maxlength="20"></li>
<li style="height:120px;">
<?php echo $captcha_html ?>
</li>
<?php } else { ?>
<li>상담내용:<textarea name="wr_content" id="wr_content" itemname="상담내용" style="height:90px; padding:2px; margin:5px 1px 1px 3px;"></textarea></li>
<?php } ?>
<li style="text-align:center; margin-top:0px;"><input type="image" src="<?php echo G5_IMG_URL; ?>/apply.png" ></li>
</ul>
</form>
2. 그누보드5 / 문서_update.php 만들기
<?php
include_once('./_common.php');
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
// 외부에서 글을 등록할 수 있는 버그가 존재하므로 비밀글 무조건 사용일때는 관리자를 제외(공지)하고 무조건 비밀글로 등록
//if (!$is_admin && $board['bo_use_secret'] == 2) {
$secret = 'secret';
//}
if ($member['mb_level'] < $board['bo_write_level']) {
alert('글을 쓸 권한이 없습니다.');
}
if ($is_guest && !chk_captcha()) {
alert('자동등록방지 숫자가 틀렸습니다.');
}
if (isset($_SESSION['ss_datetime'])) {
if ($_SESSION['ss_datetime'] >= (G5_SERVER_TIME - $config['cf_delay_sec']) && !$is_admin)
alert('너무 빠른 시간내에 게시물을 연속해서 올릴 수 없습니다.');
}
set_session("ss_datetime", G5_SERVER_TIME);
if (!isset($_POST['wr_subject']) || !trim($_POST['wr_subject']))
alert('제목을 입력하여 주십시오.');
if ($member['mb_id']) {
$mb_id = $member['mb_id'];
$wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick']));
$wr_password = $member['mb_password'];
$wr_email = addslashes($member['mb_email']);
$wr_homepage = addslashes(clean_xss_tags($member['mb_homepage']));
} else {
$mb_id = '';
// 비회원의 경우 이름이 누락되는 경우가 있음
$wr_name = clean_xss_tags(trim($_POST['wr_name']));
if (!$wr_name)
alert('이름은 필히 입력하셔야 합니다.');
$wr_password = get_encrypt_string($wr_password);
$wr_email = get_email_address(trim($_POST['wr_email']));
$wr_homepage = clean_xss_tags($wr_homepage);
}
if($_POST['wr_email']) {
$wr_email = get_email_address(trim($_POST['wr_email']));
}
$wr_num = get_next_num($write_table);
$wr_reply = '';
$sql = " insert into {$write_table}
set wr_num = '{$wr_num}',
wr_reply = '{$wr_reply}',
wr_comment = 0,
ca_name = '{$ca_name}',
wr_option = '{$html},{$secret},{$mail}',
wr_subject = '{$wr_subject}',
wr_content = '{$wr_content}',
wr_link1 = '{$wr_link1}',
wr_link2 = '{$wr_link2}',
wr_link1_hit = 0,
wr_link2_hit = 0,
wr_hit = 0,
wr_good = 0,
wr_nogood = 0,
mb_id = '{$member['mb_id']}',
wr_password = '{$wr_password}',
wr_name = '{$wr_name}',
wr_email = '{$wr_email}',
wr_homepage = '{$wr_homepage}',
wr_datetime = '".G5_TIME_YMDHIS."',
wr_last = '".G5_TIME_YMDHIS."',
wr_ip = '{$_SERVER['REMOTE_ADDR']}',
wr_1 = '{$wr_1}',
wr_2 = '{$wr_2}',
wr_3 = '{$wr_3}',
wr_4 = '{$wr_4}',
wr_5 = '{$wr_5}',
wr_6 = '{$wr_6}',
wr_7 = '{$wr_7}',
wr_8 = '{$wr_8}',
wr_9 = '{$wr_9}',
wr_10 = '{$wr_10}' ";
//echo "sql = ". $sql;
//exit;
sql_query($sql);
$wr_id = sql_insert_id();
// 부모 아이디에 UPDATE
sql_query(" update {$write_table} set wr_parent = '{$wr_id}' where wr_id = '{$wr_id}' ");
// 새글 INSERT
sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '".G5_TIME_YMDHIS."', '{$member['mb_id']}' ) ");
// 게시글 1 증가
sql_query("update {$g5['board_table']} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}'");
// 쓰기 포인트 부여
insert_point($member['mb_id'], $board['bo_write_point'], "{$board['bo_subject']} {$wr_id} 글쓰기", $bo_table, $wr_id, '쓰기');
goto_url(G5_HTTP_BBS_URL."/board.php?bo_table={$bo_table}&wr_id=".$wr_id.$qstr);
1. 상담신청 양식 작성
<?php
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
$captcha_html = '';
$captcha_js = '';
if ($is_guest) {
$captcha_html = captcha_html();
$captcha_js = chk_captcha_js();
}
?>
<script type="text/javascript">
function sms_input_check() {
var f = document.frm; // 본문 form에서의 name 값으로 수정
if(f.wr_name.value == '') {
alert('이름을 입력해 주십시오.');
f.wr_name.focus();
return false;
}
function checkPhone(wr_3) {
var regExp = /^\d{3,4}-\d{3,4}-\d{4}$/;
if(regExp.test(wr_3)) { // test 는 정규 Methods 입니다. test는 변경없음
return true;
} else {
return false;
}
}
if(f.wr_3.value == '') {
alert('연락처를 입력해 주십시오.');
f.wr_3.focus();
return false;
} else {
if(!checkPhone(f.wr_3.value)) {
alert('잘못된 전화번호입니다. 숫자, - 를 포함한 숫자만 입력하세요. 예) 050-XXXX-XXXX');
f.wr_3.focus();
return false;
}
}
/*
function checkEmail(wr_email) {
//var regExp = /^([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)(\.[0-9a-zA-Z_-]+){1,2}$/; // 이메일 체크 ( id1.id2@test.com 대응불가 )
var regExp = /^[-!#$%&'*+./0-9=?A-Z^_a-z{|}~]+@[-!#$%&'*+/0-9=?A-Z^_a-z{|}~]+.[-!#$%&'*+./0-9=?A-Z^_a-z{|}~]+$/;
if(regExp.test(wr_email)) { // test 는 정규 Methods 입니다. test는 변경없음
return true;
} else {
return false;
}
}
if(f.wr_email.value == '') {
alert('이메일 주소를 입력해 주십시오.');
f.wr_email.focus();
return false;
}
else {
if(!checkEmail(f.wr_email.value)) {
alert('이메일 주소를 바르게 입력해 주십시오.');
f.wr_email.focus();
return false;
}
}
*/
if(f.wr_content.value == '') {
alert('상담내용을 입력해 주십시오.');
f.wr_content.focus();
return false;
}
var agree = document.getElementsByName("agree_chk");
if (!agree[0].checked) {
alert("개인정보 수집 및 이용에 동의하셔야 회원가입 하실 수 있습니다.");
agree[0].focus();
return false;
}
<?php echo $captcha_js; // 캡챠 사용시 자바스크립트에서 입력된 캡챠를 검사함 ?>
}
</script>
<form class="tbl_frm03" name="frm" method="post" action="<?php echo G5_URL; ?>/문서_update.php" onSubmit="return sms_input_check(this)">
<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
<input type="hidden" name="w" value="">
<input type="hidden" name="bo_table" value="reservation">
<input type="hidden" name="wr_id" value="0">
<input type="hidden" name="sca" value="">
<input type="hidden" name="sfl" value="">
<input type="hidden" name="stx" value="">
<input type="hidden" name="spt" value="">
<input type="hidden" name="sst" value="">
<input type="hidden" name="sod" value="">
<input type="hidden" name="page" value="">
<input type="hidden" name="secret" value='secret'><!-- 비밀글 -->
<input type="hidden" name="s" accept="" value="s">
<input type="hidden" name="wr_subject" value="빠른 상담 신청">
<input type="hidden" name="wr_key" value="">
<span style="font-size:12px;">개인정보취급방침
<a href="javascript:void(window.open('<?php echo G5_URL; ?>/privacy.php','','width=590,height=300, top=130, left=500 scrollbars=yes'))">[전문보기]</a> :
<input type="radio" name="agree_chk" value="y">동의함
<input type="radio" name="agree_chk" value="n">동의하지 않음
</span>
<ul style="list-style-type: none;">
<li>이<span style="letter-spacing:27px;"> </span>름:<input type="input" name="wr_name" id="wr_name" itemname="이름" style="border:1px solid #e4eaec;background:#f7f7f7; width:144px; height:20px; padding:2px; margin:0px 1px 0px 3px;"></li>
<li>연 락 처:<input type="input" name="wr_3" id="wr_3" value="" style="border:1px solid #e4eaec;background:#f7f7f7; width:144px; height:20px; padding:2px; margin:5px 1px 0px 3px;"></li>
<?php if ($is_guest) { //자동등록방지 ?>
<li>상담내용:<textarea name="wr_content" id="wr_content" itemname="상담내용" style="height:30px; padding:2px; margin:5px 1px 1px 3px;"></textarea></li>
<li>비밀번호:<input type="password" name="wr_password" id="wr_password" <?php echo $password_required; ?> class="frm_input <?php echo $password_required; ?>" maxlength="20"></li>
<li style="height:120px;">
<?php echo $captcha_html ?>
</li>
<?php } else { ?>
<li>상담내용:<textarea name="wr_content" id="wr_content" itemname="상담내용" style="height:90px; padding:2px; margin:5px 1px 1px 3px;"></textarea></li>
<?php } ?>
<li style="text-align:center; margin-top:0px;"><input type="image" src="<?php echo G5_IMG_URL; ?>/apply.png" ></li>
</ul>
</form>
2. 그누보드5 / 문서_update.php 만들기
<?php
include_once('./_common.php');
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
// 외부에서 글을 등록할 수 있는 버그가 존재하므로 비밀글 무조건 사용일때는 관리자를 제외(공지)하고 무조건 비밀글로 등록
//if (!$is_admin && $board['bo_use_secret'] == 2) {
$secret = 'secret';
//}
if ($member['mb_level'] < $board['bo_write_level']) {
alert('글을 쓸 권한이 없습니다.');
}
if ($is_guest && !chk_captcha()) {
alert('자동등록방지 숫자가 틀렸습니다.');
}
if (isset($_SESSION['ss_datetime'])) {
if ($_SESSION['ss_datetime'] >= (G5_SERVER_TIME - $config['cf_delay_sec']) && !$is_admin)
alert('너무 빠른 시간내에 게시물을 연속해서 올릴 수 없습니다.');
}
set_session("ss_datetime", G5_SERVER_TIME);
if (!isset($_POST['wr_subject']) || !trim($_POST['wr_subject']))
alert('제목을 입력하여 주십시오.');
if ($member['mb_id']) {
$mb_id = $member['mb_id'];
$wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick']));
$wr_password = $member['mb_password'];
$wr_email = addslashes($member['mb_email']);
$wr_homepage = addslashes(clean_xss_tags($member['mb_homepage']));
} else {
$mb_id = '';
// 비회원의 경우 이름이 누락되는 경우가 있음
$wr_name = clean_xss_tags(trim($_POST['wr_name']));
if (!$wr_name)
alert('이름은 필히 입력하셔야 합니다.');
$wr_password = get_encrypt_string($wr_password);
$wr_email = get_email_address(trim($_POST['wr_email']));
$wr_homepage = clean_xss_tags($wr_homepage);
}
if($_POST['wr_email']) {
$wr_email = get_email_address(trim($_POST['wr_email']));
}
$wr_num = get_next_num($write_table);
$wr_reply = '';
$sql = " insert into {$write_table}
set wr_num = '{$wr_num}',
wr_reply = '{$wr_reply}',
wr_comment = 0,
ca_name = '{$ca_name}',
wr_option = '{$html},{$secret},{$mail}',
wr_subject = '{$wr_subject}',
wr_content = '{$wr_content}',
wr_link1 = '{$wr_link1}',
wr_link2 = '{$wr_link2}',
wr_link1_hit = 0,
wr_link2_hit = 0,
wr_hit = 0,
wr_good = 0,
wr_nogood = 0,
mb_id = '{$member['mb_id']}',
wr_password = '{$wr_password}',
wr_name = '{$wr_name}',
wr_email = '{$wr_email}',
wr_homepage = '{$wr_homepage}',
wr_datetime = '".G5_TIME_YMDHIS."',
wr_last = '".G5_TIME_YMDHIS."',
wr_ip = '{$_SERVER['REMOTE_ADDR']}',
wr_1 = '{$wr_1}',
wr_2 = '{$wr_2}',
wr_3 = '{$wr_3}',
wr_4 = '{$wr_4}',
wr_5 = '{$wr_5}',
wr_6 = '{$wr_6}',
wr_7 = '{$wr_7}',
wr_8 = '{$wr_8}',
wr_9 = '{$wr_9}',
wr_10 = '{$wr_10}' ";
//echo "sql = ". $sql;
//exit;
sql_query($sql);
$wr_id = sql_insert_id();
// 부모 아이디에 UPDATE
sql_query(" update {$write_table} set wr_parent = '{$wr_id}' where wr_id = '{$wr_id}' ");
// 새글 INSERT
sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '".G5_TIME_YMDHIS."', '{$member['mb_id']}' ) ");
// 게시글 1 증가
sql_query("update {$g5['board_table']} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}'");
// 쓰기 포인트 부여
insert_point($member['mb_id'], $board['bo_write_point'], "{$board['bo_subject']} {$wr_id} 글쓰기", $bo_table, $wr_id, '쓰기');
goto_url(G5_HTTP_BBS_URL."/board.php?bo_table={$bo_table}&wr_id=".$wr_id.$qstr);
댓글목록
등록된 댓글이 없습니다.