게시판의 페이지 표시가 안보이네요?
본문
게시판 아래쪽에 페이지 표시부분이 관리자로 로그인한 상태에서는 보이구요,
로그인이 안되어 있는 상태에서는 보이지가 않네요~
어떻게 해야 할지요?
답변 10
혹시 소스에 관리자만 노출되게
if ($is_admin)
이렇게 있는지 확인해보세요
해당 list.skin.php를 올려 보세요.
list.skin.php 내용입니다. 감사합니다.
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// 선택옵션으로 인해 셀합치기가 가변적으로 변함
$colspan = 5;
if ($is_checkbox) $colspan++;
if ($is_good) $colspan++;
if ($is_nogood) $colspan++;
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
?>
<!-- 게시판 카테고리 시작 { -->
<?php if ($is_category) { ?>
<nav id="bo_cate">
<h2><?php echo $board['bo_subject'] ?> 카테고리</h2>
<ul id="bo_cate_ul">
<?php echo $category_option ?>
</ul>
</nav>
<?php } ?>
<!-- } 게시판 카테고리 끝 -->
<!-- 게시판 목록 시작 { -->
<div id="bo_list" style="width:<?php echo $width; ?>">
<!-- 게시판 페이지 정보 { -->
<div id="bo_list_total">
<span>Total <?php echo number_format($total_count) ?>건</span>
<?php echo $page ?> 페이지
</div>
<!-- 게시판 검색 시작 { -->
<fieldset id="bo_sch">
<legend>게시물 검색</legend>
<form name="fsearch" method="get">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sop" value="and">
<label for="sfl" class="sound_only">검색대상</label>
<select name="sfl" id="sfl" >
<option value="wr_subject"<?php echo get_selected($sfl, 'wr_subject', true); ?>>제목</option>
<option value="wr_content"<?php echo get_selected($sfl, 'wr_content'); ?>>내용</option>
<option value="wr_subject||wr_content"<?php echo get_selected($sfl, 'wr_subject||wr_content'); ?>>제목+내용</option>
<option value="mb_id,1"<?php echo get_selected($sfl, 'mb_id,1'); ?>>회원아이디</option>
<option value="mb_id,0"<?php echo get_selected($sfl, 'mb_id,0'); ?>>회원아이디(코)</option>
<option value="wr_name,1"<?php echo get_selected($sfl, 'wr_name,1'); ?>>글쓴이</option>
<option value="wr_name,0"<?php echo get_selected($sfl, 'wr_name,0'); ?>>글쓴이(코)</option>
</select>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="stx" value="<?php echo stripslashes($stx) ?>" required id="stx" class="frm_input required" size="26" maxlength="20">
<input type="submit" value="검색" class="btn_submit">
</form>
</fieldset>
<script type="text/javascript">
$('#sfl').fancySelect();
</script>
<!-- } 게시판 검색 끝 -->
<!-- } 게시판 페이지 정보 및 버튼 끝 -->
<form name="fboardlist" id="fboardlist" action="<?php echo G5_BBS_URL; ?>/board_list_update.php" onsubmit="return fboardlist_submit(this);" method="post">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<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="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="page" value="<?php echo $page ?>">
<input type="hidden" name="sw" value="">
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $board['bo_subject'] ?> 목록</caption>
<thead>
<tr>
<th scope="col">번호</th>
<?php if ($is_checkbox) { ?>
<th scope="col">
<label for="chkall" class="sound_only">현재 페이지 게시물 전체</label>
<input type="checkbox" id="chkall" onclick="if (this.checked) all_checked(true); else all_checked(false);">
</th>
<?php } ?>
<th scope="col">제목</th>
<th scope="col">글쓴이</th>
<th scope="col"><?php echo subject_sort_link('wr_datetime', $qstr2, 1) ?>날짜</a></th>
<th scope="col"><?php echo subject_sort_link('wr_hit', $qstr2, 1) ?>조회</a></th>
<?php if ($is_good) { ?><th scope="col"><?php echo subject_sort_link('wr_good', $qstr2, 1) ?>추천</a></th><?php } ?>
<?php if ($is_nogood) { ?><th scope="col"><?php echo subject_sort_link('wr_nogood', $qstr2, 1) ?>비추천</a></th><?php } ?>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $i<count($list); $i++) {
?>
<tr class="<?php if ($list[$i]['is_notice']) echo "bo_notice"; ?>">
<td class="td_num">
<?php
if ($list[$i]['is_notice']) // 공지사항
echo '<strong>공지</strong>';
else if ($wr_id == $list[$i]['wr_id'])
echo "<span class=\"bo_current\">열람중</span>";
else
echo $list[$i]['num'];
?>
</td>
<?php if ($is_checkbox) { ?>
<td class="td_chk">
<label for="chk_wr_id_<?php echo $i ?>" class="sound_only"><?php echo $list[$i]['subject'] ?></label>
<input type="checkbox" name="chk_wr_id[]" value="<?php echo $list[$i]['wr_id'] ?>" id="chk_wr_id_<?php echo $i ?>">
</td>
<?php } ?>
<td class="td_subject">
<?php
echo $list[$i]['icon_reply'];
if ($is_category && $list[$i]['ca_name']) {
?>
<a href="<?php echo $list[$i]['ca_name_href'] ?>" class="bo_cate_link"><?php echo $list[$i]['ca_name'] ?></a>
<?php } ?>
<a href="<?php echo $list[$i]['href'] ?>">
<?php echo $list[$i]['subject'] ?>
<?php if ($list[$i]['comment_cnt']) { ?><span class="sound_only">댓글</span><?php echo $list[$i]['comment_cnt']; ?><span class="sound_only">개</span><?php } ?>
</a>
<?php
// if ($list[$i]['link']['count']) { echo '['.$list[$i]['link']['count']}.']'; }
// if ($list[$i]['file']['count']) { echo '<'.$list[$i]['file']['count'].'>'; }
if (isset($list[$i]['icon_new'])) echo $list[$i]['icon_new'];
if (isset($list[$i]['icon_hot'])) echo $list[$i]['icon_hot'];
if (isset($list[$i]['icon_file'])) echo $list[$i]['icon_file'];
if (isset($list[$i]['icon_link'])) echo $list[$i]['icon_link'];
if (isset($list[$i]['icon_secret'])) echo $list[$i]['icon_secret'];
?>
</td>
<td class="td_name sv_use"><?php echo $list[$i]['name'] ?></td>
<td class="td_date"><?php echo $list[$i]['datetime2'] ?></td>
<td class="td_num"><?php echo $list[$i]['wr_hit'] ?></td>
<?php if ($is_good) { ?><td class="td_num"><?php echo $list[$i]['wr_good'] ?></td><?php } ?>
<?php if ($is_nogood) { ?><td class="td_num"><?php echo $list[$i]['wr_nogood'] ?></td><?php } ?>
</tr>
<?php } ?>
<?php if (count($list) == 0) { echo '<tr><td colspan="'.$colspan.'" class="empty_table">게시물이 없습니다.</td></tr>'; } ?>
</tbody>
</table>
</div>
<?php if ($list_href || $is_checkbox || $write_href) { ?>
<div class="bo_fx">
<?php if ($is_checkbox) { ?>
<ul class="btn_bo_adm">
<li><input type="submit" name="btn_submit" value="선택삭제" onclick="document.pressed=this.value"></li>
<li><input type="submit" name="btn_submit" value="선택복사" onclick="document.pressed=this.value"></li>
<li><input type="submit" name="btn_submit" value="선택이동" onclick="document.pressed=this.value"></li>
</ul>
<?php } ?>
<?php if ($rss_href || $write_href) { ?>
<ul class="btn_bo_user">
<?php if ($rss_href) { ?><li><a href="<?php echo $rss_href ?>" class="btn_b01">RSS</a></li><?php } ?>
<?php if ($admin_href) { ?><li><a href="<?php echo $admin_href ?>" class="btn_admin">관리자</a></li><?php } ?>
<?php if ($list_href) { ?><li><a href="<?php echo $list_href ?>" class="btn_b01">목록</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php } ?>
</ul>
<?php } ?>
<!-- 페이지 -->
<?php echo $write_pages; ?>
<!-- 페이지 -->
</div>
<?php } ?>
</form>
</div>
<?php if($is_checkbox) { ?>
<noscript>
<p>자바스크립트를 사용하지 않는 경우<br>별도의 확인 절차 없이 바로 선택삭제 처리하므로 주의하시기 바랍니다.</p>
</noscript>
<?php } ?>
<?php if ($is_checkbox) { ?>
<script>
function all_checked(sw) {
var f = document.fboardlist;
for (var i=0; i<f.length; i++) {
if (f.elements[i].name == "chk_wr_id[]")
f.elements[i].checked = sw;
}
}
function fboardlist_submit(f) {
var chk_count = 0;
for (var i=0; i<f.length; i++) {
if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)
chk_count++;
}
if (!chk_count) {
alert(document.pressed + "할 게시물을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택복사") {
select_copy("copy");
return;
}
if(document.pressed == "선택이동") {
select_copy("move");
return;
}
if(document.pressed == "선택삭제") {
if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다\n\n답변글이 있는 게시글을 선택하신 경우\n답변글도 선택하셔야 게시글이 삭제됩니다."))
return false;
f.removeAttribute("target");
f.action = g5_bbs_url+"/board_list_update.php";
}
return true;
}
// 선택한 게시물 복사 및 이동
function select_copy(sw) {
var f = document.fboardlist;
if (sw == "copy")
str = "복사";
else
str = "이동";
var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");
f.sw.value = sw;
f.target = "move";
f.action = g5_bbs_url+"/move.php";
f.submit();
}
</script>
<?php } ?>
<!-- } 게시판 목록 끝 -->
/bbs/list.php에서
// 페이지의 공지개수가 목록수 보다 작을 때만 실행
if($page_rows > 0) {
$result = sql_query($sql);
echo $sql; exit;
여기서 나오는
admin로그인한 상태와 아닌 상태 두 가지
query문을 알려 주세요.
admin 로그인 상태가 아니면 조건문이 자동으로 붙는 거 같습니다. 1:1 문의 게시판 같이요.
list.php 내용입니다. 제가 프로그램은 몰라서요. 감사합니다.
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// 분류 사용 여부
$is_category = false;
$category_option = '';
if ($board['bo_use_category']) {
$is_category = true;
$category_href = get_pretty_url($bo_table);
$category_option .= '<li><a href="'.$category_href.'"';
if ($sca=='')
$category_option .= ' id="bo_cate_on"';
$category_option .= '>전체</a></li>';
$categories = explode('|', $board['bo_category_list']); // 구분자가 , 로 되어 있음
for ($i=0; $i<count($categories); $i++) {
$category = trim($categories[$i]);
if ($category=='') continue;
$category_option .= '<li><a href="'.(get_pretty_url($bo_table,'','sca='.urlencode($category))).'"';
$category_msg = '';
if ($category==$sca) { // 현재 선택된 카테고리라면
$category_option .= ' id="bo_cate_on"';
$category_msg = '<span class="sound_only">열린 분류 </span>';
}
$category_option .= '>'.$category_msg.$category.'</a></li>';
}
}
$sop = strtolower($sop);
if ($sop != 'and' && $sop != 'or')
$sop = 'and';
// 분류 선택 또는 검색어가 있다면
$stx = trim($stx);
//검색인지 아닌지 구분하는 변수 초기화
$is_search_bbs = false;
if ($sca || $stx || $stx === '0') { //검색이면
$is_search_bbs = true; //검색구분변수 true 지정
$sql_search = get_sql_search($sca, $sfl, $stx, $sop);
// 가장 작은 번호를 얻어서 변수에 저장 (하단의 페이징에서 사용)
$sql = " select MIN(wr_num) as min_wr_num from {$write_table} ";
$row = sql_fetch($sql);
$min_spt = (int)$row['min_wr_num'];
if (!$spt) $spt = $min_spt;
$sql_search .= " and (wr_num between {$spt} and ({$spt} + {$config['cf_search_part']})) ";
// 원글만 얻는다. (코멘트의 내용도 검색하기 위함)
// 라엘님 제안 코드로 대체 http://sir.kr/g5_bug/2922
$sql = " SELECT COUNT(DISTINCT `wr_parent`) AS `cnt` FROM {$write_table} WHERE {$sql_search} ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
/*
$sql = " select distinct wr_parent from {$write_table} where {$sql_search} ";
$result = sql_query($sql);
$total_count = sql_num_rows($result);
*/
} else {
$sql_search = "";
$total_count = $board['bo_count_write'];
}
if(G5_IS_MOBILE) {
$page_rows = $board['bo_mobile_page_rows'];
$list_page_rows = $board['bo_mobile_page_rows'];
} else {
$page_rows = $board['bo_page_rows'];
$list_page_rows = $board['bo_page_rows'];
}
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
// 년도 2자리
$today2 = G5_TIME_YMD;
$list = array();
$i = 0;
$notice_count = 0;
$notice_array = array();
// 공지 처리
if (!$is_search_bbs) {
$arr_notice = explode(',', trim($board['bo_notice']));
$from_notice_idx = ($page - 1) * $page_rows;
if($from_notice_idx < 0)
$from_notice_idx = 0;
$board_notice_count = count($arr_notice);
for ($k=0; $k<$board_notice_count; $k++) {
if (trim($arr_notice[$k]) == '') continue;
$row = sql_fetch(" select * from {$write_table} where wr_id = '{$arr_notice[$k]}' ");
if (!$row['wr_id']) continue;
$notice_array[] = $row['wr_id'];
if($k < $from_notice_idx) continue;
$list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']);
$list[$i]['is_notice'] = true;
$list[$i]['num'] = 0;
$i++;
$notice_count++;
if($notice_count >= $list_page_rows)
break;
}
}
$total_page = ceil($total_count / $page_rows); // 전체 페이지 계산
$from_record = ($page - 1) * $page_rows; // 시작 열을 구함
// 공지글이 있으면 변수에 반영
if(!empty($notice_array)) {
$from_record -= count($notice_array);
if($from_record < 0)
$from_record = 0;
if($notice_count > 0)
$page_rows -= $notice_count;
if($page_rows < 0)
$page_rows = $list_page_rows;
}
// 관리자라면 CheckBox 보임
$is_checkbox = false;
if ($is_member && ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id'] || $board['bo_admin'] == $member['mb_id']))
$is_checkbox = true;
// 정렬에 사용하는 QUERY_STRING
$qstr2 = 'bo_table='.$bo_table.'&sop='.$sop;
// 0 으로 나눌시 오류를 방지하기 위하여 값이 없으면 1 로 설정
$bo_gallery_cols = $board['bo_gallery_cols'] ? $board['bo_gallery_cols'] : 1;
$td_width = (int)(100 / $bo_gallery_cols);
// 정렬
// 인덱스 필드가 아니면 정렬에 사용하지 않음
//if (!$sst || ($sst && !(strstr($sst, 'wr_id') || strstr($sst, "wr_datetime")))) {
if (!$sst) {
if ($board['bo_sort_field']) {
$sst = $board['bo_sort_field'];
} else {
$sst = "wr_num, wr_reply";
$sod = "";
}
} else {
$board_sort_fields = get_board_sort_fields($board, 1);
if (!$sod && array_key_exists($sst, $board_sort_fields)) {
$sst = $board_sort_fields[$sst];
} else {
// 게시물 리스트의 정렬 대상 필드가 아니라면 공백으로 (nasca 님 09.06.16)
// 리스트에서 다른 필드로 정렬을 하려면 아래의 코드에 해당 필드를 추가하세요.
// $sst = preg_match("/^(wr_subject|wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : "";
$sst = preg_match("/^(wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : "";
}
}
if(!$sst)
$sst = "wr_num, wr_reply";
if ($sst) {
$sql_order = " order by {$sst} {$sod} ";
}
if ($is_search_bbs) {
$sql = " select distinct wr_parent from {$write_table} where {$sql_search} {$sql_order} limit {$from_record}, $page_rows ";
} else {
$sql = " select * from {$write_table} where wr_is_comment = 0 ";
if(!empty($notice_array))
$sql .= " and wr_id not in (".implode(', ', $notice_array).") ";
$sql .= " {$sql_order} limit {$from_record}, $page_rows ";
}
// 페이지의 공지개수가 목록수 보다 작을 때만 실행
if($page_rows > 0) {
$result = sql_query($sql);
$k = 0;
while ($row = sql_fetch_array($result))
{
// 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다
if ($is_search_bbs)
$row = sql_fetch(" select * from {$write_table} where wr_id = '{$row['wr_parent']}' ");
$list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']);
if (strstr($sfl, 'subject')) {
$list[$i]['subject'] = search_font($stx, $list[$i]['subject']);
}
$list[$i]['is_notice'] = false;
$list_num = $total_count - ($page - 1) * $list_page_rows - $notice_count;
$list[$i]['num'] = $list_num - $k;
$i++;
$k++;
}
}
g5_latest_cache_data($board['bo_table'], $list);
$write_pages = get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, get_pretty_url($bo_table, '', $qstr.'&page='));
$list_href = '';
$prev_part_href = '';
$next_part_href = '';
if ($is_search_bbs) {
$list_href = get_pretty_url($bo_table);
$patterns = array('#&page=[0-9]*#', '#&spt=[0-9\-]*#');
//if ($prev_spt >= $min_spt)
$prev_spt = $spt - $config['cf_search_part'];
if (isset($min_spt) && $prev_spt >= $min_spt) {
$qstr1 = preg_replace($patterns, '', $qstr);
$prev_part_href = get_pretty_url($bo_table,0,$qstr1.'&spt='.$prev_spt.'&page=1');
$write_pages = page_insertbefore($write_pages, '<a href="'.$prev_part_href.'" class="pg_page pg_search pg_prev">이전검색</a>');
}
$next_spt = $spt + $config['cf_search_part'];
if ($next_spt < 0) {
$qstr1 = preg_replace($patterns, '', $qstr);
$next_part_href = get_pretty_url($bo_table,0,$qstr1.'&spt='.$next_spt.'&page=1');
$write_pages = page_insertafter($write_pages, '<a href="'.$next_part_href.'" class="pg_page pg_search pg_next">다음검색</a>');
}
}
$write_href = '';
if ($member['mb_level'] >= $board['bo_write_level']) {
$write_href = short_url_clean(G5_BBS_URL.'/write.php?bo_table='.$bo_table);
}
$nobr_begin = $nobr_end = "";
if (preg_match("/gecko|firefox/i", $_SERVER['HTTP_USER_AGENT'])) {
$nobr_begin = '<nobr>';
$nobr_end = '</nobr>';
}
// RSS 보기 사용에 체크가 되어 있어야 RSS 보기 가능 061106
$rss_href = '';
if ($board['bo_use_rss_view']) {
$rss_href = G5_BBS_URL.'/rss.php?bo_table='.$bo_table;
}
$stx = get_text(stripslashes($stx));
include_once($board_skin_path.'/list.skin.php');
// 페이지의 공지개수가 목록수 보다 작을 때만 실행
if($page_rows > 0) {
$result = sql_query($sql);
$k = 0;
while ($row = sql_fetch_array($result))
이 부분을
// 페이지의 공지개수가 목록수 보다 작을 때만 실행
if($page_rows > 0) {
$result = sql_query($sql);
echo $sql; exit; // 추가하시고
$k = 0;
while ($row = sql_fetch_array($result))
나온 결과를 적어 보세요.
여기서 나오는
admin로그인한 상태와 아닌 상태 두 가지
query문을 알려 주세요.
list.php 파일의 알려주신 위치에 ' echo $sql; exit; ' 추가하고 게시판 열었더니,
관리자 로그인 했을때와, 안했을때와 동일하게 게시판은 보이지 않고,
' select * from g5_write_adver where wr_is_comment = 0 order by wr_num, wr_reply limit 0, 10 '
요런 문구가 나옵니다.
부탁드립니다. 감사합니다.
관리자로 로그인했을때랑 로그인 안했을때랑 같은 결과입니다. 게시판은 보이지 않고 위 문구만 보입니다.
감사합니다.
list.skin.php 내용 첫 부분에
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
echo $write_pages; // 추가하시고
admin 로그인 전후로 어떻게 나오는지 살펴 보세요.
해결되었습니다.
그동안 도와주셔서 감사합니다 ~^^