Files
2026-06-11 18:47:38 +09:00

134 lines
4.8 KiB
PHP

<?php
$sub_menu = "810100";
include_once('./_common.php');
auth_check_menu($auth, $sub_menu, 'r');
$g5['title'] = '상담 문의 내역';
include_once(G5_ADMIN_PATH.'/admin.head.php');
$sql_common = " FROM {$g5['contact_inquiry_table']} ";
$sql_search = " WHERE (1) ";
if ($stx) {
$sql_search .= " AND ( ";
switch ($sfl) {
case "contact_name" :
case "contact_hp" :
case "contact_subject" :
$sql_search .= " ({$sfl} like '%{$stx}%') ";
break;
default :
$sql_search .= " ({$sfl} like '%{$stx}%') ";
break;
}
$sql_search .= " ) ";
}
if (!$sst) {
$sst = "id";
$sod = "desc";
}
$sql_order = " order by {$sst} {$sod} ";
$sql = " select count(*) as cnt {$sql_common} {$sql_search} ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select * {$sql_common} {$sql_search} {$sql_order} limit {$from_record}, {$rows} ";
$result = sql_query($sql);
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
?>
<div class="local_ov01 local_ov">
<?php echo $listall; ?>
<span class="btn_ov01"><span class="ov_txt">전체 </span><span class="ov_num"> <?php echo number_format($total_count); ?>건</span></span>
</div>
<form name="fsearch" id="fsearch" class="local_sch01 local_sch" method="get">
<div class="sch_last">
<strong>검색</strong>
<input type="hidden" name="page" value="<?php echo $page; ?>">
<select name="sfl" id="sfl">
<option value="contact_name"<?php echo get_selected($_GET['sfl'], "contact_name"); ?>>이름</option>
<option value="contact_hp"<?php echo get_selected($_GET['sfl'], "contact_hp"); ?>>연락처</option>
<option value="contact_subject"<?php echo get_selected($_GET['sfl'], "contact_subject"); ?>>주거형태</option>
</select>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="stx" value="<?php echo $stx; ?>" id="stx" required class="frm_input">
<button type="submit" class="btn_submit">검색</button>
</div>
</form>
<form name="fcontactlist" id="fcontactlist" method="post" action="./contact_list_update.php" onsubmit="return fcontactlist_submit(this);">
<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; ?>">
<input type="hidden" name="token" value="<?php echo $token; ?>">
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col">번호</th>
<th scope="col">주거형태</th>
<th scope="col">이름</th>
<th scope="col">연락처</th>
<th scope="col">주소</th>
<th scope="col">문의내용</th>
<th scope="col">등록일</th>
<th scope="col">관리</th>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $row=sql_fetch_array($result); $i++) {
$bg = 'bg'.($i%2);
?>
<tr class="<?php echo $bg; ?>">
<td class="td_num"><?php echo $row['id']; ?></td>
<td class="td_category"><?php echo $row['contact_subject']; ?></td>
<td class="td_name"><?php echo $row['contact_name']; ?></td>
<td class="td_tel"><?php echo $row['contact_hp']; ?></td>
<td class="td_left">
<?php
echo "(" . $row['contact_zip'] . ") ";
echo $row['contact_addr1'] . " " . $row['contact_addr2'];
?>
</td>
<td class="td_left"><?php echo conv_content($row['contact_message'], 0); ?></td>
<td class="td_datetime"><?php echo $row['created_at']; ?></td>
<td class="td_mng">
<a href="./contact_form.php?w=u&amp;id=<?php echo $row['id']; ?>&amp;<?php echo $qstr; ?>" class="btn btn_03">수정</a>
<a href="./contact_form_update.php?w=d&amp;id=<?php echo $row['id']; ?>&amp;<?php echo $qstr; ?>" onclick="return delete_confirm(this);" class="btn btn_02">삭제</a>
</td>
</tr>
<?php
}
if ($i == 0)
echo '<tr><td colspan="8" class="empty_table">자료가 없습니다.</td></tr>';
?>
</tbody>
</table>
</div>
</form>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, $_SERVER['SCRIPT_NAME'].'?'.$qstr.'&amp;page='); ?>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>