사용후기, 상품문의 코드 수정 완료

This commit is contained in:
gnuboard
2013-06-18 18:05:07 +09:00
parent 4e37dc6abd
commit 3680563f12
12 changed files with 206 additions and 697 deletions

View File

@ -1,6 +1,7 @@
<?php
$sub_menu = '400660';
include_once('./_common.php');
include_once(G4_CKEDITOR_PATH.'/ckeditor.lib.php');
auth_check($auth[$sub_menu], "w");
@ -21,6 +22,13 @@ $qstr = 'page='.$page.'&amp;sort1='.$sort1.'&amp;sort2='.$sort2;
<?php//=subtitle($g4['title'])?>
<form name="fitemqaform" method="post" action="./itemqaformupdate.php" onsubmit="return fitemqaform_submit(this);">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="iq_id" value="<?php echo $iq_id; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="sort1" value="<?php echo $sort1; ?>">
<input type="hidden" name="sort2" value="<?php echo $sort2; ?>">
<section class="cbox">
<h2>상품문의 수정/답변</h2>
<p>상품에 대한 문의에 답변하실 수 있습니다. 상품 문의 내용의 수정도 가능합니다.</p>
@ -48,11 +56,12 @@ $qstr = 'page='.$page.'&amp;sort1='.$sort1.'&amp;sort2='.$sort2;
</tr>
<tr>
<th scope="row"><label for="iq_question">질문</label></th>
<td><textarea name="iq_question" id="iq_question" rows="7" required class="required"><?php echo get_text($iq['iq_question']); ?></textarea></td>
<td><?php echo editor_html('iq_question', $iq['iq_question']); ?></td>
</tr>
<tr>
<th scope="row"><label for="iq_answer">답변</label></th>
<td><textarea name="iq_answer" id="iq_answer" rows="7"><?php echo get_text($iq['iq_answer']); ?></textarea></td>
<td><?php echo editor_html('iq_answer', $iq['iq_answer']); ?></td>
<!-- <td><textarea name="iq_answer" id="iq_answer" rows="7"><?php echo get_text($iq['iq_answer']); ?></textarea></td> -->
</tr>
</tbody>
</table>
@ -65,6 +74,16 @@ $qstr = 'page='.$page.'&amp;sort1='.$sort1.'&amp;sort2='.$sort2;
</section>
<script>
function fitemqaform_submit(f)
{
<?php echo get_editor_js('iq_question'); ?>
<?php echo get_editor_js('iq_answer'); ?>
return true;
}
</script>
<?php
include_once (G4_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -9,14 +9,10 @@ if ($w == 'd')
else
auth_check($auth[$sub_menu], "w");
$iq = sql_fetch(" select * from {$g4['shop_item_qa_table']} where iq_id = '$iq_id' ");
if (!$iq['iq_id']) {
alert('등록된 자료가 없습니다.');
}
$qstr = "page=$page&amp;sort1=$sort1&amp;sort2=$sort2";
if ($w == "u") {
if ($w == "u")
{
$sql = "update {$g4['shop_item_qa_table']}
set iq_subject = '$iq_subject',
iq_question = '$iq_question',
@ -25,12 +21,8 @@ if ($w == "u") {
sql_query($sql);
goto_url("./itemqaform.php?w=$w&amp;iq_id=$iq_id&amp;$qstr");
} else if ($w == "d") {
$sql = "delete from {$g4['shop_item_qa_table']} where iq_id = '$iq_id' ";
sql_query($sql);
goto_url("./itemqalist.php?$qstr");
} else {
}
else {
alert();
}
?>

View File

@ -110,9 +110,21 @@ if ($sfl || $stx) // 검색 결과일 때만 처음 버튼을 보여줌
<li><?php echo subject_sort_link('iq_answer'); ?>답변<span class="sound_only"> 순 정렬</span></a></li>
</ul>
<form name="fitemqalist" method="post" action="./itemqalistupdate.php" onsubmit="return fitemqalist_submit(this);" autocomplete="off">
<input type="hidden" name="sca" value="<?php echo $sca; ?>">
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<table class="frm_basic">
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">상품문의 전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<th scope="col">상품명</th>
<th scope="col">이름</th>
<th scope="col">질문</th>
@ -124,36 +136,84 @@ if ($sfl || $stx) // 검색 결과일 때만 처음 버튼을 보여줌
<?php
for ($i=0; $row=mysql_fetch_array($result); $i++) {
$row['iq_subject'] = cut_str($row['iq_subject'], 30, "...");
$href = G4_SHOP_URL.'/item.php?it_id='.$row['it_id'];
$name = get_sideview($row['mb_id'], $row['iq_name'], $row['mb_email'], $row['mb_homepage']);
$answer = $row['iq_answer'] ? 'Y' : '&nbsp;';
$iq_question = get_view_thumbnail($row['iq_question'], 300);
$iq_answer = $row['iq_answer'] ? get_view_thumbnail($row['iq_answer'], 300) : "답변이 등록되지 않았습니다.";
?>
<tr>
<td>
<label for="chk_<?php echo $i; ?>" class="sound_only"><?php echo get_text($row['iq_subject']) ?> 상품문의</label>
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i; ?>">
<input type="hidden" name="iq_id[<?php echo $i; ?>]" value="<?php echo $row['iq_id']; ?>">
</td>
<td><a href="<?php echo $href; ?>"><?php echo get_it_image($row['it_id'], 50, 50); ?><?php echo cut_str($row['it_name'],30); ?></a></td>
<td class="td_name"><?php echo $name; ?></td>
<td class="sit_qa_subject"><?php echo $row['iq_subject']; ?></td>
<td class="sit_qa_subject">
<a href="#" class="qa_href" onclick="return false;" target="<?php echo $i; ?>"><?php echo $row['iq_subject']; ?></a>
<div id="qa_div<?php echo $i; ?>" class="qa_div" style="display:none;">
<strong>문의내용</strong><br>
<?php echo $iq_question; ?>
<strong>답변</strong><br>
<?php echo $iq_answer; ?>
</div>
</td>
<td class="sit_qa_answer"><?php echo $answer; ?></td>
<td class="td_smallmng">
<a href="./itemqaform.php?w=u&amp;iq_id=<?php echo $row['iq_id']; ?>&amp;<?php echo $qstr; ?>"><span class="sound_only"><?php echo $row['iq_subject']; ?> </span>수정</a>
<a href="javascript:del('./itemqaformupdate.php?w=d&amp;iq_id=<?php echo $row['iq_id']; ?>&amp;$qstr');"><span class="sound_only"><?php echo $row['iq_subject']; ?> </span>삭제</a>
</td>
</tr>
<?php
}
if ($i == 0) {
echo '<tr><td colspan="5" class="empty_table"><span>자료가 없습니다.</span></td></tr>';
echo '<tr><td colspan="6" class="empty_table"><span>자료가 없습니다.</span></td></tr>';
}
?>
</tbody>
</table>
<div class="btn_list">
<input type="submit" name="act_button" value="선택수정" onclick="document.pressed=this.value">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value">
</div>
</form>
</section>
<?php echo get_paging(G4_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page="); ?>
<script>
function fitemqalist_submit(f)
{
if (!is_checked("chk[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택삭제") {
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
return false;
}
}
return true;
}
$(function(){
$(".qa_href").click(function(){
var $content = $("#qa_div"+$(this).attr("target"));
$(".qa_div").each(function(index, value){
if ($(this).get(0) == $content.get(0)) { // 객체의 비교시 .get(0) 를 사용한다.
$(this).is(":hidden") ? $(this).show() : $(this).hide();
} else {
$(this).hide();
}
});
});
});
</script>
<?php
include_once (G4_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,39 @@
<?php
$sub_menu = '400660';
include_once('./_common.php');
check_demo();
if (!count($_POST['chk'])) {
alert($_POST['act_button']." 하실 항목을 하나 이상 체크하세요.");
}
if ($_POST['act_button'] == "선택수정") {
auth_check($auth[$sub_menu], 'w');
for ($i=0; $i<count($_POST['chk']); $i++) {
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$sql = "update {$g4['shop_item_qa_table']}
set iq_confirm = '{$_POST['iq_confirm'][$k]}'
where iq_id = '{$_POST['iq_id'][$k]}' ";
sql_query($sql);
}
} else if ($_POST['act_button'] == "선택삭제") {
auth_check($auth[$sub_menu], 'd');
for ($i=0; $i<count($_POST['chk']); $i++) {
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$sql = "delete from {$g4['shop_item_qa_table']} where iq_id = '{$_POST['iq_id'][$k]}' ";
sql_query($sql);
}
}
goto_url("./itemqalist.php?sca=$sca&amp;sst=$sst&amp;sod=$sod&amp;sfl=$sfl&amp;stx=$stx&amp;page=$page");
?>

View File

@ -32,7 +32,6 @@ $qstr = 'page='.$page.'&amp;sort1='.$sort1.'&amp;sort2='.$sort2;
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="sort1" value="<?php echo $sort1; ?>">
<input type="hidden" name="sort2" value="<?php echo $sort2; ?>">
<input type="hidden" name="is_confirm" value="<?php echo $is['is_confirm']; ?>">
<section class="cbox">
<h2>사용후기 수정</h2>

View File

@ -600,16 +600,6 @@ else
$("#itemqa").load("./itemqa.php", {it_id:"<?php echo $it_id; ?>"});
});
</script>
<<<<<<< HEAD
<?php
/*
$qa_page_rows = 10; // 페이지당 목록수
include_once('./itemqa.inc.php');
*/
?>
=======
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
</section>
<?php if ($default['de_baesong_content']) { // 배송정보 내용이 있다면 ?>

View File

@ -1,240 +0,0 @@
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<section id="sit_qa_list">
<h3>등록된 상품문의</h3>
<?php
$sql_common = " from {$g4['shop_item_qa_table']} where it_id = '{$it['it_id']}' ";
// 테이블의 전체 레코드수만 얻음
$sql = " select COUNT(*) as cnt " . $sql_common;
$row = sql_fetch($sql);
$qa_total_count = $row['cnt'];
$qa_total_page = ceil($qa_total_count / $qa_page_rows); // 전체 페이지 계산
if ($qa_page == "") $qa_page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$qa_from_record = ($qa_page - 1) * $qa_page_rows; // 시작 레코드 구함
$sql = "select *
$sql_common
order by iq_id desc
limit $qa_from_record, $qa_page_rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$num = $qa_total_count - ($qa_page - 1) * $qa_page_rows - $i;
$iq_name = get_text($row['iq_name']);
$iq_subject = conv_subject($row['iq_subject'],50, '…');
$iq_question = conv_content($row['iq_question'],0);
$iq_answer = conv_content($row['iq_answer'],0);
$iq_time = substr($row['iq_time'], 2, 14);
//$qa = "<img src='$g4[shop_img_path]/icon_poll_q.gif' border=0>";
//if ($row[iq_answer]) $qa .= "<img src='$g4[shop_img_path]/icon_answer.gif' border=0>";
//$qa = "$qa";
$iq_stats = '';
$iq_answer = '';
$iq_flag = 0;
if ($row['iq_answer'])
{
$iq_answer = conv_content($row['iq_answer'],0);
$iq_stats = '답변완료';
} else {
$iq_stats = '답변전';
$iq_answer = '답변이 등록되지 않았습니다.';
$iq_flag = 1;
}
if ($i == 0) echo '<ol id="sit_qa_ol">';
?>
<li class="sit_qa_li">
<button type="button" class="sit_qa_li_title" onclick="javascript:qa_menu('sit_qa_con_<?php echo $i; ?>')"><b><?php echo $num; ?>.</b> <?php echo $iq_subject; ?></button>
<dl class="sit_qa_dl">
<dt>작성자</dt>
<dd><?php echo $iq_name; ?></dd>
<dt>작성일</dt>
<dd><?php echo $iq_time; ?></dd>
<dt>상태</dt>
<dd><?php echo $iq_stats; ?></dd>
</dl>
<div id="sit_qa_con_<?php echo $i; ?>" class="sit_qa_con">
<p class="sit_qa_qaq">
<strong>문의내용</strong><br>
<?php echo $iq_question; // 상품 문의 내용 ?>
</p>
<p class="sit_qa_qaa">
<strong>답변</strong><br>
<?php echo $iq_answer; ?>
</p>
<textarea id="tmp_iq_id<?php echo $i; ?>"><?php echo $row['iq_id']; ?></textarea>
<textarea id="tmp_iq_name<?php echo $i; ?>"><?php echo $row['iq_name']; ?></textarea>
<textarea id="tmp_iq_subject<?php echo $i; ?>"><?php echo $row['iq_subject']; ?></textarea>
<textarea id="tmp_iq_question<?php echo $i; ?>"><?php echo $row['iq_question']; ?></textarea>
<?php if ($row['mb_id'] == $member['mb_id'] && $iq_answer == 0) { ?>
<div class="sit_qa_cmd">
<button type="button" onclick="javascript:itemqa_update(<?php echo $i; ?>);" class="btn01">수정</button>
<button type="button" onclick="javascript:itemqa_delete(fitemqa_password<?php echo $i; ?>, <?php echo $i; ?>);" class="btn01">삭제</button>
</div>
<?php } ?>
</div>
<div id="sit_qa_pw_<?php echo $i; ?>" class="sit_qa_pw">
<form name="fitemqa_password<?php echo $i; ?>" method="post" action="./itemqaupdate.php" autocomplete="off">
<input type="hidden" name="w" value="">
<input type="hidden" name="iq_id" value="">
<input type="hidden" name="it_id" value="<?php echo $it['it_id']; ?>">
<span>삭제하시려면 글 작성 시 입력하신 패스워드를 입력해주세요.</span>
<label for="iq_password_<?=$i?>">패스워드</label>
<input type="password" name="iq_password" id="iq_password_<?=$i?>" required class="frm_input">
<input type="submit" value="확인" class="btn_frmline">
</form>
</div>
</li>
<?php }
if ($i >= 0) echo '</ol>';
if (!$i) echo '<p class="sit_empty">상품문의가 없습니다.</p>';
?>
</section>
<div id="sit_qa_wbtn">
<button type="button" id="iq_write" class="btn_submit" onclick="javascript:itemqa_insert();">상품문의 쓰기</button>
</div>
<section id="sit_qa_w">
<h3>상품문의 작성</h3>
<form name="fitemqa" method="post" onsubmit="return fitemqa_submit(this);" autocomplete="off">
<input type="hidden" name="w" value="">
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="iq_id" value="">
<input type="hidden" name="it_id" value="<?php echo $it['it_id']; ?>">
<table class="frm_tbl">
<colgroup>
<col class="grid_3">
<col>
</colgroup>
<tbody>
<?php if (!$is_member) { ?>
<tr>
<th scope="row"><label for="iq_name">이름</label></th>
<td><input type="text" name="iq_name" id="iq_name" required class="frm_input" maxlength="20" minlength="2"></td>
</tr>
<tr>
<th scope="row"><label for="iq_password">패스워드</label></th>
<td>
<span class="frm_info">패스워드는 최소 3글자 이상 입력하십시오.</span>
<input type="password" name="iq_password" id="iq_password" required class="frm_input" maxlength="20" minlength="3">
</td>
</tr>
<?php } ?>
<tr>
<th scope="row"><label for="iq_subject">제목</label></th>
<td><input type="text" name="iq_subject" id="iq_subject" required class="frm_input" size="71" maxlength="100"></td>
</tr>
<tr>
<th scope="row"><label for="iq_question">내용</label></th>
<td><textarea name="iq_question" id="iq_question" required></textarea></td>
</tr>
<tr>
<th scope="row">자동등록방지</th>
<td><?php echo $captcha_html; ?></td>
</tr>
</tbody>
</table>
<div class="btn_confirm">
<input type="submit" value="작성완료" class="btn_submit">
</div>
</form>
</section>
<?php if ($qa_pages) get_paging(10, $qa_page, $qa_total_page, './item.php?it_id='.$it_id.'&amp;'.$qstr.'&amp;qa_page=', '#qa'); // 페이징 ?>
<script>
$(function() {
});
function fitemqa_submit(f)
{
<?php echo chk_captcha_js(); ?>
f.action = "itemqaupdate.php";
return true;
}
function itemqa_insert()
{
/*
if (!g4_is_member) {
alert("로그인 하시기 바랍니다.");
return;
}
*/
var f = document.fitemqa;
var id = document.getElementById('sit_qa_w');
id.style.display = 'block';
f.w.value = '';
f.iq_id.value = '';
if (!g4_is_member)
{
f.iq_name.value = '';
f.iq_name.readOnly = false;
f.iq_password.value = '';
}
f.iq_subject.value = '';
f.iq_question.value = '';
}
function itemqa_update(idx)
{
var f = document.fitemqa;
var id = document.getElementById('sit_qa_w');
id.style.display = 'block';
f.w.value = 'u';
f.iq_id.value = document.getElementById('tmp_iq_id'+idx).value;
if (!g4_is_member)
{
f.iq_name.value = document.getElementById('tmp_iq_name'+idx).value;
f.iq_name.readOnly = true;
}
f.iq_subject.value = document.getElementById('tmp_iq_subject'+idx).value;
f.iq_question.value = document.getElementById('tmp_iq_question'+idx).value;
}
function itemqa_delete(f, idx)
{
var id = document.getElementById('sit_qa_w');
f.w.value = 'd';
f.iq_id.value = document.getElementById('tmp_iq_id'+idx).value;
if (g4_is_member)
{
if (confirm("삭제하시겠습니까?"))
f.submit();
}
else
{
id.style.display = 'none';
document.getElementById('itemqa_password'+idx).style.display = 'block';
}
}
</script>

View File

@ -1,4 +1,3 @@
<<<<<<< HEAD
<?php
include_once('./_common.php');
include_once(G4_LIB_PATH.'/thumbnail.lib.php');
@ -9,7 +8,7 @@ $itemqa_list = "./itemqalist.php";
$itemqa_form = "./itemqaform.php?it_id=".$it_id;
$itemqa_formupdate = "./itemqaformupdate.php?it_id=".$it_id;
include_once(G4_PATH.'/head.sub.php');
$thumbnail_width = 500;
?>
<section id="sit_qa_list">
@ -37,7 +36,7 @@ include_once(G4_PATH.'/head.sub.php');
$iq_star = get_star($row['iq_score']);
$iq_name = get_text($row['iq_name']);
$iq_subject = conv_subject($row['iq_subject'],50,"…");
$iq_question = get_view_thumbnail($row['iq_question'], 300);
$iq_question = get_view_thumbnail($row['iq_question'], $thumbnail_width);
$iq_time = substr($row['iq_time'], 2, 8);
$iq_href = './itemqalist.php?bo_table=itemqa&amp;wr_id='.$row['wr_id'];
@ -47,15 +46,15 @@ include_once(G4_PATH.'/head.sub.php');
$iq_stats = '';
$iq_answer = '';
$iq_flag = 0;
if ($row['iq_answer'])
{
$iq_answer = get_view_thumbnail($row['iq_answer'], 300);
$iq_answer = get_view_thumbnail($row['iq_answer'], $thumbnail_width);
$iq_stats = '답변완료';
$is_answer = true;
} else {
$iq_stats = '답변전';
$iq_answer = '답변이 등록되지 않았습니다.';
$iq_flag = 1;
$is_answer = false;
}
if ($i == 0) echo '<ol id="sit_qa_ol">';
@ -77,41 +76,22 @@ include_once(G4_PATH.'/head.sub.php');
<strong>문의내용</strong><br>
<?php echo $iq_question; // 상품 문의 내용 ?>
</p>
<p class="sit_qa_qaa">
<strong>답변</strong><br>
<?php echo $iq_answer; ?>
</p>
<?php if ($row['mb_id'] == $member['mb_id'] && $iq_answer == 0) { ?>
<?php if ($is_admin || ($row['mb_id'] == $member['mb_id'] && !$is_answer)) { ?>
<div class="sit_qa_cmd">
<a href="<?php echo $itemqa_form."&amp;iq_id={$row['iq_id']}&amp;w=u"; ?>" class="itemqa_form" onclick="return false;">수정</a>
<a href="<?php echo $itemqa_formupdate."&amp;iq_id={$row['iq_id']}&amp;w=d&amp;hash={$hash}"; ?>" class="itemqa_delete" onclick="return false;">삭제</a>
<a href="<?php echo $itemqa_formupdate."&amp;iq_id={$row['iq_id']}&amp;w=d&amp;hash={$hash}"; ?>" class="itemqa_delete">삭제</a>
<!-- <button type="button" onclick="javascript:itemqa_update(<?php echo $i; ?>);" class="btn01">수정</button>
<button type="button" onclick="javascript:itemqa_delete(fitemqa_password<?php echo $i; ?>, <?php echo $i; ?>);" class="btn01">삭제</button> -->
</div>
<?php } ?>
</div>
</div>
</li>
<li class="sit_qa_li">
<button type="button" class="sit_qa_li_title" onclick="javascript:qa_menu('sit_qa_con_<?php echo $i; ?>')"><b><?php echo $iq_num; ?>.</b> <?php echo $iq_subject; ?></button>
<dl class="sit_qa_dl">
<dt>작성자</dt>
<dd><?php echo $iq_name; ?></dd>
<dt>작성일</dt>
<dd><?php echo $iq_time; ?></dd>
</dl>
<div id="sit_qa_con_<?php echo $i; ?>" class="sit_qa_con">
<p>
<?php echo $iq_question; // 상품문의 질문 ?>
<?php echo $iq_answer; // 상품문의 답변 ?>
<a href="<?php echo $itemqa_form."&amp;iq_id={$row['iq_id']}&amp;w=u"; ?>" class="itemqa_form" onclick="return false;">수정</a>
<a href="<?php echo "./itemqaformupdate.php?w=d&amp;it_id={$row['it_id']}&amp;iq_id={$row['iq_id']}&amp;hash={$hash}"; ?>">삭제</a>
<p class="sit_qa_qaa">
<strong>답변</strong><br>
<?php echo $iq_answer; ?>
</p>
</div>
</div>
</li>
<?php }
@ -173,7 +153,11 @@ echo itemqa_page(10, $page, $total_page, "./itemqa.php?it_id=$it_id&amp;page=",
<script>
$(function(){
$(".itemqa_form").click(function(){
window.open(this.href, "itemqa_form", "width=800,height=550");
window.open(this.href, "itemqa_form", "width=800,height=500");
});
$(".itemqa_delete").click(function(){
return confirm("정말 삭제 하시겠습니까?\n\n삭제후에는 되돌릴수 없습니다.");
});
$(".qa_href").click(function(){
@ -193,217 +177,3 @@ $(function(){
});
});
</script>
<?php
include_once(G4_PATH.'/tail.sub.php');
?>
=======
<?php
include_once('./_common.php');
$it_id = $_REQUEST['it_id'];
?>
<section id="sit_qa_list">
<h3>등록된 상품문의</h3>
<?php
$sql_common = " from {$g4['shop_item_qa_table']} where it_id = '$it_id' ";
// 테이블의 전체 레코드수만 얻음
$sql = " select COUNT(*) as cnt " . $sql_common;
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = 5;
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 레코드 구함
$sql = "select *
$sql_common
order by iq_id desc
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$num = $total_count - ($page - 1) * $rows - $i;
$iq_name = get_text($row['iq_name']);
$iq_subject = conv_subject($row['iq_subject'],50, '…');
$iq_question = conv_content($row['iq_question'],0);
$iq_answer = conv_content($row['iq_answer'],0);
$iq_time = substr($row['iq_time'], 2, 14);
//$qa = "<img src='$g4[shop_img_path]/icon_poll_q.gif' border=0>";
//if ($row[iq_answer]) $qa .= "<img src='$g4[shop_img_path]/icon_answer.gif' border=0>";
//$qa = "$qa";
$iq_stats = '';
$iq_answer = '';
$iq_flag = 0;
if ($row['iq_answer'])
{
$iq_answer = conv_content($row['iq_answer'],0);
$iq_stats = '답변완료';
} else {
$iq_stats = '답변전';
$iq_answer = '답변이 등록되지 않았습니다.';
$iq_flag = 1;
}
if ($i == 0) echo '<ol id="sit_qa_ol">';
?>
<li class="sit_qa_li">
<button type="button" class="sit_qa_li_title" onclick="javascript:qa_menu('sit_qa_con_<?php echo $i; ?>')"><b><?php echo $num; ?>.</b> <?php echo $iq_subject; ?></button>
<dl class="sit_qa_dl">
<dt>작성자</dt>
<dd><?php echo $iq_name; ?></dd>
<dt>작성일</dt>
<dd><?php echo $iq_time; ?></dd>
<dt>상태</dt>
<dd><?php echo $iq_stats; ?></dd>
</dl>
<div id="sit_qa_con_<?php echo $i; ?>" class="sit_qa_con">
<p class="sit_qa_qaq">
<strong>문의내용</strong><br>
<?php echo $iq_question; // 상품 문의 내용 ?>
</p>
<p class="sit_qa_qaa">
<strong>답변</strong><br>
<?php echo $iq_answer; ?>
</p>
<textarea id="tmp_iq_id<?php echo $i; ?>"><?php echo $row['iq_id']; ?></textarea>
<textarea id="tmp_iq_name<?php echo $i; ?>"><?php echo $row['iq_name']; ?></textarea>
<textarea id="tmp_iq_subject<?php echo $i; ?>"><?php echo $row['iq_subject']; ?></textarea>
<textarea id="tmp_iq_question<?php echo $i; ?>"><?php echo $row['iq_question']; ?></textarea>
<?php if ($row['mb_id'] == $member['mb_id'] && $iq_answer == 0) { ?>
<div class="sit_qa_cmd">
<a href="./itemqaform.php?w=u&amp;it_id=<?php echo $it_id; ?>&amp;iq_id=<?php echo $row['iq_id']; ?>" class="itemqa_mod btn01">수정</a>
<a href="./itemqaformupdate.php?w=d&amp;it_id=<?php echo $it_id; ?>&amp;iq_id=<?php echo $row['iq_id']; ?>" class="itemqa_del btn01">삭제</a>
</div>
<?php } ?>
</div>
</li>
<?php }
if ($i >= 0) echo '</ol>';
if (!$i) echo '<p class="sit_empty">상품문의가 없습니다.</p>';
?>
</section>
<?php
// 현재페이지, 총페이지수, 한페이지에 보여줄 행, URL
function itemqa_page($write_pages, $cur_page, $total_page, $url, $add="")
{
$url = preg_replace('#&amp;page=[0-9]*(&amp;page=)$#', '$1', $url);
$str = '';
if ($cur_page > 1) {
$str .= '<a href="'.$url.'1'.$add.'" class="qa_page qa_start" onclick="return false;">처음</a>'.PHP_EOL;
}
$start_page = ( ( (int)( ($cur_page - 1 ) / $write_pages ) ) * $write_pages ) + 1;
$end_page = $start_page + $write_pages - 1;
if ($end_page >= $total_page) $end_page = $total_page;
if ($start_page > 1) $str .= '<a href="'.$url.($start_page-1).$add.'" class="qa_page qa_prev" onclick="return false;">이전</a>'.PHP_EOL;
if ($total_page > 1) {
for ($k=$start_page;$k<=$end_page;$k++) {
if ($cur_page != $k)
$str .= '<a href="'.$url.$k.$add.'" class="qa_page" onclick="return false;">'.$k.'</a><span class="sound_only">페이지</span>'.PHP_EOL;
else
$str .= '<span class="sound_only">열린</span><strong class="qa_current">'.$k.'</strong><span class="sound_only">페이지</span>'.PHP_EOL;
}
}
if ($total_page > $end_page) $str .= '<a href="'.$url.($end_page+1).$add.'" class="qa_page qa_next">다음</a>'.PHP_EOL;
if ($cur_page < $total_page) {
$str .= '<a href="'.$url.$total_page.$add.'" class="qa_page qa_end" onclick="return false;">맨끝</a>'.PHP_EOL;
}
if ($str)
return "<nav class=\"qa_wrap\"><span class=\"qa\">{$str}</span></nav>";
else
return "";
}
echo itemqa_page($config['cf_write_pages'], $page, $total_page, "./itemqa.php?it_id=$it_id&amp;page=", "");
?>
<div id="sit_qa_wbtn">
<a href="./itemqaform.php?it_id=<?php echo $it_id; ?>" id="itemqa_form" class="btn02">상품문의 쓰기</a>
</div>
<script>
$(function(){
$("#itemqa_form").click(function(){
window.open(this.href, "itemqa_form", "width=800,height=550");
return false;
});
$(".itemqa_mod").live("click", function() {
window.open(this.href, "itemqa_form", "width=800,height=550");
return false;
});
$(".itemqa_del").live("click", function() {
if(!confirm("상품문의를 삭제하시겠습니까?"))
return false;
<?php if($is_member) { ?>
document.location.href = this.href;
<?php } else { ?>
var iq_pass_frm = "<div id=\"iq_password_frm\">";
iq_pass_frm += "<form name=\"fitemqapass\" method=\"post\" action=\""+this.href+"\">";
iq_pass_frm += "<label for=\"iq_password\">비밀번호</label>";
iq_pass_frm += "<input type=\"password\" name=\"iq_password\" id=\"iq_password\" size=\"20\">";
iq_pass_frm += "<input type=\"submit\" value=\"확인\">";
iq_pass_frm += "</form>";
iq_pass_frm += "</div>";
$("#iq_password_frm").remove();
$(this).after(iq_pass_frm);
return false;
<?php } ?>
});
$("form[name=fitemqapass]").live("submit", function() {
var pass = trim($("input[name=iq_password]").val());
if(pass == "") {
alert("비밀번호를 입력해 주십시오.");
return false;
}
return true;
});
$(".qa_href").click(function(){
var $content = $("#qa_div"+$(this).attr("target"));
$(".qa_div").each(function(index, value){
if ($(this).get(0) == $content.get(0)) { // 객체의 비교시 .get(0) 를 사용한다.
$(this).is(":hidden") ? $(this).show() : $(this).hide();
} else {
$(this).hide();
}
});
});
$(".qa_page").click(function(){
//alert($(this).attr("href"));
$(top.document).find('#itemqa').load($(this).attr("href"));
});
});
</script>
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03

View File

@ -1,4 +1,3 @@
<<<<<<< HEAD
<?php
include_once("./_common.php");
include_once(G4_CKEDITOR_PATH.'/ckeditor.lib.php');
@ -80,79 +79,4 @@ $(function() {
<?php
include_once(G4_PATH.'/tail.sub.php');
=======
<?php
include_once('./_common.php');
include_once(G4_GCAPTCHA_PATH.'/gcaptcha.lib.php');
$captcha_html = captcha_html();
$w = escape_trim($_REQUEST['w']);
$it_id = escape_trim($_REQUEST['it_id']);
$iq_id = escape_trim($_REQUEST['iq_id']);
if($w == 'u') {
$sql = " select * from {$g4['shop_item_qa_table']} where it_id = '$it_id' and iq_id = '$iq_id' ";
$qa = sql_fetch($sql);
}
include_once(G4_PATH.'/head.sub.php');
?>
<div>
<form name="fitemqa" method="post" action="./itemqaformupdate.php" onsubmit="return fitemqa_submit(this);" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="iq_id" value="<?php echo $iq_id; ?>">
<input type="hidden" name="it_id" value="<?php echo $it_id; ?>">
<table class="frm_tbl">
<colgroup>
<col class="grid_3">
<col>
</colgroup>
<tbody>
<?php if (!$is_member) { ?>
<tr>
<th scope="row"><label for="iq_name">이름</label></th>
<td><input type="text" name="iq_name" id="iq_name" value="<?php echo $qa['iq_name']; ?>" required class="frm_input" maxlength="20" minlength="2"></td>
</tr>
<tr>
<th scope="row"><label for="iq_password">패스워드</label></th>
<td>
<span class="frm_info">패스워드는 최소 3글자 이상 입력하십시오.</span>
<input type="password" name="iq_password" id="iq_password" required class="frm_input" maxlength="20" minlength="3">
</td>
</tr>
<?php } ?>
<tr>
<th scope="row"><label for="iq_subject">제목</label></th>
<td><input type="text" name="iq_subject" id="iq_subject" value="<?php echo $qa['iq_subject']; ?>" required class="frm_input" size="71" maxlength="100"></td>
</tr>
<tr>
<th scope="row"><label for="iq_question">내용</label></th>
<td><textarea name="iq_question" id="iq_question" required><?php echo $qa['iq_question']; ?></textarea></td>
</tr>
<tr>
<th scope="row">자동등록방지</th>
<td><?php echo $captcha_html; ?></td>
</tr>
</tbody>
</table>
<div class="btn_confirm">
<input type="submit" value="작성완료" class="btn_submit">
</div>
</form>
</div>
<script>
function fitemqa_submit(f)
{
<?php echo chk_captcha_js(); ?>
return true;
}
</script>
<?php
include_once(G4_PATH.'/tail.sub.php');
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
?>

View File

@ -1,16 +1,15 @@
<?php
include_once('./_common.php');
<<<<<<< HEAD
if (!$is_member) {
alert_close("상품문의는 회원만 작성이 가능합니다.");
}
$iq_id = escape_trim($_REQUEST['iq_id']);
$iq_subject = escape_trim($_REQUEST['iq_subject']);
$iq_question = escape_trim($_REQUEST['iq_question']);
$iq_answer = escape_trim($_REQUEST['iq_answer']);
$hash = escape_trim($_REQUEST['hash']);
$iq_id = escape_trim($_POST['iq_id']);
$iq_subject = escape_trim($_POST['iq_subject']);
$iq_question = escape_trim(stripslashes($_POST['iq_question']));
$iq_answer = escape_trim(stripslashes($_POST['iq_answer']));
$hash = escape_trim($_POST['hash']);
if ($w == "" || $w == "u") {
$iq_name = $member['mb_name'];
@ -18,53 +17,12 @@ if ($w == "" || $w == "u") {
if (!$iq_subject) alert("제목을 입력하여 주십시오.");
if (!$iq_question) alert("질문을 입력하여 주십시오.");
=======
include_once(G4_GCAPTCHA_PATH.'/gcaptcha.lib.php');
if ($w == '' || $w == 'u')
{
if (!chk_captcha()) {
alert('자동등록방지 숫자가 틀렸습니다.');
}
if (!$is_member)
{
if (!trim($_POST['iq_name'])) alert('이름을 입력하여 주십시오.');
if (!trim($_POST['iq_password'])) alert('패스워드를 입력하여 주십시오.');
}
else
{
$iq_name = $member['mb_name'];
$iq_password = $member['mb_password'];
}
$iq_password = sql_password($iq_password);
if (!trim($_POST['iq_subject'])) alert('제목을 입력하여 주십시오.');
if (!trim($_POST['iq_question'])) alert('내용을 입력하여 주십시오.');
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
}
$url = "./item.php?it_id=$it_id";
$url = "./item.php?it_id=$it_id&amp;_=".get_token()."#sit_qa";
<<<<<<< HEAD
if ($w == "")
{
=======
if ($w == '')
{
$sql = " select max(iq_id) as max_iq_id from {$g4['shop_item_qa_table']} ";
$row = sql_fetch($sql);
$max_iq_id = $row['max_iq_id'];
$sql = " select max(iq_id) as max_iq_id from {$g4['shop_item_qa_table']}
where it_id = '$it_id'
and mb_id = '{$member['mb_id']}' ";
$row = sql_fetch($sql);
if ($row['max_iq_id'] && $row['max_iq_id'] == $max_iq_id)
alert('같은 상품에 대하여 계속해서 질문 하실 수 없습니다.');
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
$sql = "insert {$g4['shop_item_qa_table']}
set it_id = '$it_id',
mb_id = '{$member['mb_id']}',
@ -76,24 +34,17 @@ if ($w == '')
iq_ip = '$REMOTE_ADDR' ";
sql_query($sql);
<<<<<<< HEAD
alert_opener("상품문의가 등록 되었습니다.", $url);
}
else if ($w == "u")
=======
alert_opener('상품문의가 등록되었습니다.', $url);
}
else if ($w == 'u')
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
{
$sql = " select iq_password from {$g4['shop_item_qa_table']} where iq_id = '$iq_id' ";
$row = sql_fetch($sql);
if ($row['iq_password'] != $iq_password)
<<<<<<< HEAD
alert("패스워드가 틀리므로 수정하실 수 없습니다.");
=======
alert('패스워드가 틀리므로 수정하실 수 없습니다.');
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
if (!$is_amdin)
{
$sql = " select count(*) as cnt from {$g4['shop_item_qa_table']} where mb_id = '{$member['mb_id']}' and iq_id = '$iq_id' ";
$row = sql_fetch($sql);
if (!$row['cnt'])
alert("자신의 상품문의만 수정하실 수 있습니다.");
}
$sql = " update {$g4['shop_item_qa_table']}
set iq_subject = '$iq_subject',
@ -101,25 +52,19 @@ else if ($w == 'u')
where iq_id = '$iq_id' ";
sql_query($sql);
<<<<<<< HEAD
alert_opener("상품문의가 수정 되었습니다.", $url);
}
else if ($w == "d")
{
if (!$is_admin)
=======
alert_opener('상품문의가 수정되었습니다.', $url);
}
else if ($w == 'd')
{
if ($is_member)
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
{
$sql = " select count(*) as cnt from {$g4['shop_item_qa_table']} where mb_id = '{$member['mb_id']}' and iq_id = '$iq_id' ";
$sql = " select iq_answer from {$g4['shop_item_qa_table']} where mb_id = '{$member['mb_id']}' and iq_id = '$iq_id' ";
$row = sql_fetch($sql);
if (!$row['cnt'])
<<<<<<< HEAD
if (!$row)
alert("자신의 상품문의만 삭제하실 수 있습니다.");
if ($row['iq_answer'])
alert("답변이 있는 상품문의는 삭제하실 수 없습니다.");
}
//$sql = " delete from {$g4['shop_item_qa_table']} where mb_id = '{$member['mb_id']}' and iq_id = '$iq_id' ";
@ -127,23 +72,5 @@ else if ($w == 'd')
sql_query($sql);
alert("상품문의가 삭제 되었습니다.", $url);
=======
die('자신의 상품문의만 삭제하실 수 있습니다.');
}
else
{
$iq_password = sql_password($iq_password);
$sql = " select iq_password from {$g4['shop_item_qa_table']} where iq_id = '$iq_id' ";
$row = sql_fetch($sql);
if ($row['iq_password'] != $iq_password)
die('패스워드가 틀리므로 삭제하실 수 없습니다.');
}
$sql = " delete from {$g4['shop_item_qa_table']} where mb_id = '{$member['mb_id']}' and iq_id = '$iq_id' ";
sql_query($sql);
goto_url($url);
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
}
?>

View File

@ -4,10 +4,9 @@ include_once(G4_LIB_PATH.'/thumbnail.lib.php');
$it_id = $_REQUEST['it_id'];
$itemuse_form = "./itemuseform.php?it_id=".$it_id;
$itemuse_list = "./itemuselist.php";
//include_once(G4_PATH.'/head.sub.php');
$itemuse_form = "./itemuseform.php?it_id=".$it_id;
$itemuse_formupdate = "./itemuseformupdate.php?it_id=".$it_id;
?>
<section id="sit_use_list">
@ -48,6 +47,8 @@ $itemuse_list = "./itemuselist.php";
$is_time = substr($row['is_time'], 2, 8);
$is_href = './itemuselist.php?bo_table=itemuse&amp;wr_id='.$row['wr_id'];
$hash = md5($row['is_id'].$row['is_time'].$row['is_ip']);
// http://stackoverflow.com/questions/6967081/show-hide-multiple-divs-with-jquery?answertab=votes#tab-top
if ($i == 0) echo '<ol id="sit_use_ol">';
@ -68,6 +69,13 @@ $itemuse_list = "./itemuselist.php";
<p>
<?php echo $is_content; // 사용후기 내용 ?>
</p>
<?php if ($is_admin || $row['mb_id'] == $member['mb_id']) { ?>
<div class="sit_use_cmd">
<a href="<?php echo $itemuse_form."&amp;is_id={$row['is_id']}&amp;w=u"; ?>" class="itemuse_form" onclick="return false;">수정</a>
<a href="<?php echo $itemuse_formupdate."&amp;is_id={$row['is_id']}&amp;w=d&amp;hash={$hash}"; ?>" class="itemuse_delete">삭제</a>
</div>
<?php } ?>
</div>
</li>
@ -122,18 +130,25 @@ echo itemuse_page($config['cf_write_pages'], $page, $total_page, "./itemuse.php?
?>
<div id="sit_use_wbtn">
<!-- <a href="javascript:itemusewin('it_id=<?php echo $it_id; ?>');">사용후기 쓰기<span class="sound_only"> 새 창</span></a> -->
<a href="<?php echo $itemuse_form; ?>" id="itemuse_form" class="btn02">사용후기 쓰기<span class="sound_only"> 새 창</span></a>
<a href="<?php echo $itemuse_list; ?>" id="itemuse_list" class="btn01">더보기</a>
</div>
<script>
$(function(){
$("#itemuse_form").click(function(){
window.open(this.href, "itemuse_form", "width=800,height=550");
$(".itemuse_form").click(function(){
window.open(this.href, "itemuse_form", "width=800,height=500");
return false;
});
$(".itemuse_delete").click(function(){
if (confirm("정말 삭제 하시겠습니까?\n\n삭제후에는 되돌릴수 없습니다.")) {
return true;
} else {
return false;
}
});
$(".use_href").click(function(){
var $content = $("#use_div"+$(this).attr("target"));
$(".use_div").each(function(index, value){
@ -151,7 +166,3 @@ $(function(){
});
});
</script>
<?php
//include_once(G4_PATH.'/tail.sub.php');
?>

View File

@ -16,9 +16,10 @@ if ($w == "" || $w == "u") {
if (!$is_content) alert("내용을 입력하여 주십시오.");
}
$url = "./item.php?it_id=$it_id";
$url = "./item.php?it_id=$it_id&amp;_=".get_token()."#sit_use";
if ($w == "") {
if ($w == "")
{
/*
$sql = " select max(is_id) as max_is_id from {$g4['shop_item_use_table']} ";
$row = sql_fetch($sql);
@ -49,7 +50,9 @@ if ($w == "") {
} else {
alert_opener("사용후기가 등록 되었습니다.", $url);
}
} else if ($w == "u") {
}
else if ($w == "u")
{
$sql = " select is_password from {$g4['shop_item_use_table']} where is_id = '$is_id' ";
$row = sql_fetch($sql);
if ($row['is_password'] != $is_password)
@ -64,4 +67,19 @@ if ($w == "") {
alert_opener("사용후기가 수정 되었습니다.", $url);
}
else if ($w == "d")
{
if (!$is_admin)
{
$sql = " select count(*) as cnt from {$g4['shop_item_use_table']} where mb_id = '{$member['mb_id']}' and is_id = '$is_id' ";
$row = sql_fetch($sql);
if (!$row['cnt'])
alert("자신의 사용후기만 삭제하실 수 있습니다.");
}
$sql = " delete from {$g4['shop_item_use_table']} where is_id = '$is_id' and md5(concat(is_id,is_time,is_ip)) = '{$hash}' ";
sql_query($sql);
alert("사용후기를 삭제 하였습니다.", $url);
}
?>