Files
firstgarden-web-gnu/manager/adm/ent_list.php

100 lines
4.1 KiB
PHP

<?php
// annual_member.php 연간회원권
include_once "_common.php";
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
include_once FG_MANAGER_PATH."/head.php";
// 검색 변수 초기화, 검색 관련
$search_word = isset($_REQUEST["search_word"]) ? $_REQUEST["search_word"] : ""; // 검색어
$search_cat = isset($_REQUEST["search_cat"]) ? $_REQUEST["search_cat"] : ""; // 카테고리
$search_sdate = isset($_REQUEST["search_sdate"]) ? $_REQUEST["search_sdate"] : "";
$search_edate = isset($_REQUEST["search_edate"]) ? $_REQUEST["search_edate"] : "";
$search = $where = $search_count = "";
if ($search_word) $search .= " ( mem_no LIKE '%$search_word%' ) ";
if ($search_cat) {
if ($search_word) $search .= "AND";
$search .= " cat_name = '{$search_cat}'";
}
if ($search_sdate) {
if ($search_word || $search_cat) $search .= "AND";
$search .= " exp_sdate >= $search_sdate";
}
if ($search_edate) {
if ($search_word || $search_cat || $search_edate) $search .= "AND";
$search .= " exp_edate =< $search_edate";
}
if ($search) {
$where = "WHERE {$search}";
$search_count = get_num_rows($fg['enter_table'], $where); // 검색 결과 수 구하기
}
// 검색 쿼리 만들기 끝
$record_count = get_num_rows($fg['enter_table']); // 전체 갯수 구하기
$query = "SELECT * FROM {$fg['enter_table']} {$where} ORDER BY ent_datetime DESC {$query_limit}";
$result = sql_query($query);
$R = array();
while($row=sql_fetch_array($result)) { // 전체 배열에 저장
array_push($R, $row);
}
?>
<script>
document.getElementById('sdate').value = new Date().toISOString().substring(0, 10);
</script>
<!-- 검색폼 시작 -->
<div class="d-flex flex-column mb-3">
<p>검색은 구분/성명/연락처/회원번호로만 가능합니다.</p>
<form class="search" method="get" action="">
<div class="d-flex flex-row flex-wrap gap-2 mb-3">
<input type="radio" name="search_cat" id="search_cat_all" class="btn-check" value="" <?php if (empty($search_cat)) echo "checked" ?>>
<label class="btn btn-outline-primary" for="search_cat_all">전체</label>
<input type="radio" name="search_cat" id="search_cat_vip" class="btn-check" value="VIP" <?php if ($search_cat === $R['cat_name']) echo "checked" ?>>
<label class="btn btn-outline-primary" for="search_cat_vip">VIP</label>
<input type="radio" name="search_cat" id="search_cat_annu" class="btn-check" value="연간" <?php if ($search_cat === $R['cat_name']) echo "checked" ?>>
<label class="btn btn-outline-primary" for="search_cat_annu">연간</label>
</div>
<div class="input-group col-md-6">
<span class="input-group-text" id="search_word">회원검색</span>
<input type="text" name="search_word" class="form-control" id="search_word" aria-describedby="search_word" placeholder="검색어를 입력하세요" autofocus value="<?=$search_word ?>">
<button type="submit" class="btn btn-secondary">검색</button>
</div>
</form>
</div>
<!-- 검색폼 끝 -->
<div class="d-flex justify-content-between my-1">
<div>
<p>전체 : <b><?=$record_count?></b> 건 | 검색 결과 : <?=$search_count ? $search_count : $record_count?> 건</p>
</div>
<!--
<div class="d-flex flex-row-reverse column-gap-2">
<form method="post" action="inc/annual_member_list_excel.php">
<button type="submit" class="btn btn-secondary" >엑셀저장</button>
</form>
</div>
-->
</div>
<table class="table table-striped align-middle table-hover">
<colgroup>
<col width="">
<col width="">
<col width="">
</colgroup>
<thead>
<tr class="align-middle">
<th class="text-center">구분</th>
<th class="text-center">회원번호</th>
<th class="text-center">방문일시</th>
</tr>
</thead>
<tbody class="table-group-divider">
<?php foreach($R as $r) {
echo '<tr>';
echo '<td class="text-center">' . ($r['cat_name'] ?? '') . '</td>';
echo '<td class="text-center">' . $r['mem_no'] . '</td>';
echo '<td class="text-center">' . $r['ent_datetime'] . '</td>';
echo '</tr>';
} ?>
</tbody>
</table>
<?php include_once FG_MANAGER_PATH."/tail.php";