관리자와 글작성자만 글을 볼수있고 비회원은 다볼수있는게금 도와주세요 정보
관리자와 글작성자만 글을 볼수있고 비회원은 다볼수있는게금 도와주세요본문
제가 root님의 작품을 가지고 질문드리고 싶습니다
여기에서 글작성자는 작성한 글만 볼수있고 관리자는 다 볼수 있게금 만드셨는데...
글작성자는 작성한 글을 볼수있고
비회원과 관리자는 다 볼수있게금 가능한가요?
도와주시면 짐심으로 감사드리겠습니다
-----------------------------------------------------------------------
if(!$is_admin ) { // 관리자가 아닐경우 자기가 작성한 글만 보이도록 한다.
// 분류 선택 또는 검색어가 있다면
if ($sca || $stx)
{
$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 = $row[min_wr_num];
if (!$spt) $spt = $min_spt;
//$sql_search .= " and (wr_num between '".$spt."' and '".($spt + $config[cf_search_part])."') ";
$sql_search .= " and mb_id = '$member[mb_id]' and wr_is_comment = 0 and (wr_num between '".$spt."' and '".($spt + $config[cf_search_part])."') ";
// 원글만 얻는다. (코멘트의 내용도 검색하기 위함)
$sql = " select distinct wr_parent from $write_table where $sql_search ";
$result = sql_query($sql);
$total_count = mysql_num_rows($result);
}
else
{
$sql_search = "";
// 게시판의 글 수
//$sql = " select count(*) as cnt from $g4[write_prefix]$bo_table where wr_is_comment = 0 ";
$sql = " select count(*) as cnt from $g4[write_prefix]$bo_table where mb_id = '$member[mb_id]' and wr_is_comment = 0 ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
//$total_count = $board[bo_count_write];
}
$total_page = ceil($total_count / $board[bo_page_rows]); // 전체 페이지 계산
if (!$page) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $board[bo_page_rows]; // 시작 열을 구함
if ($board[bo_gallery_cols])
$td_width = (int)(100 / $board[bo_gallery_cols]);
// 정렬
if (!$sst)
{
$sst = "wr_num, wr_reply";
$sod = "";
}
$sql_order = " order by $sst $sod ";
if ($sca || $stx)
{
$sql = " select distinct wr_parent from $write_table where $sql_search $sql_order limit $from_record, $board[bo_page_rows] ";
}
else
{
//$sql = " select * from $write_table where wr_is_comment = 0 $sql_order limit $from_record, $board[bo_page_rows] ";
$sql = " select * from $write_table where mb_id = '$member[mb_id]' and wr_is_comment = 0 $sql_order limit $from_record, $board[bo_page_rows] ";
}
$result = sql_query($sql);
$list = array();
$i = 0;
if (!$sca && !$stx)
{
$arr_notice = split("\n", trim($board[bo_notice]));
for ($k=0; $k<count($arr_notice); $k++)
{
$row = sql_fetch(" select * from $write_table where wr_id = '$arr_notice[$k]' ");
if (!$row[wr_id])
continue;
$list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);
$list[$i][is_notice] = true;
$i++;
}
}
$k = 0;
while ($row = sql_fetch_array($result))
{
// 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다
if ($sca || $stx)
$row = sql_fetch(" select * from $write_table where wr_id = '$row[wr_parent]' ");
$list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);
if (strstr($sfl, "subject"))
$list[$i][subject] = search_font($stx, $list[$i][subject]);
$list[$i][is_notice] = false;
$list[$i][num] = number_format($total_count - ($page - 1) * $board[bo_page_rows] - $k);
$i++;
$k++;
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "./board.php?bo_table=$bo_table".$qstr."&page=");
}
여기에서 글작성자는 작성한 글만 볼수있고 관리자는 다 볼수 있게금 만드셨는데...
글작성자는 작성한 글을 볼수있고
비회원과 관리자는 다 볼수있게금 가능한가요?
도와주시면 짐심으로 감사드리겠습니다
-----------------------------------------------------------------------
if(!$is_admin ) { // 관리자가 아닐경우 자기가 작성한 글만 보이도록 한다.
// 분류 선택 또는 검색어가 있다면
if ($sca || $stx)
{
$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 = $row[min_wr_num];
if (!$spt) $spt = $min_spt;
//$sql_search .= " and (wr_num between '".$spt."' and '".($spt + $config[cf_search_part])."') ";
$sql_search .= " and mb_id = '$member[mb_id]' and wr_is_comment = 0 and (wr_num between '".$spt."' and '".($spt + $config[cf_search_part])."') ";
// 원글만 얻는다. (코멘트의 내용도 검색하기 위함)
$sql = " select distinct wr_parent from $write_table where $sql_search ";
$result = sql_query($sql);
$total_count = mysql_num_rows($result);
}
else
{
$sql_search = "";
// 게시판의 글 수
//$sql = " select count(*) as cnt from $g4[write_prefix]$bo_table where wr_is_comment = 0 ";
$sql = " select count(*) as cnt from $g4[write_prefix]$bo_table where mb_id = '$member[mb_id]' and wr_is_comment = 0 ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
//$total_count = $board[bo_count_write];
}
$total_page = ceil($total_count / $board[bo_page_rows]); // 전체 페이지 계산
if (!$page) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $board[bo_page_rows]; // 시작 열을 구함
if ($board[bo_gallery_cols])
$td_width = (int)(100 / $board[bo_gallery_cols]);
// 정렬
if (!$sst)
{
$sst = "wr_num, wr_reply";
$sod = "";
}
$sql_order = " order by $sst $sod ";
if ($sca || $stx)
{
$sql = " select distinct wr_parent from $write_table where $sql_search $sql_order limit $from_record, $board[bo_page_rows] ";
}
else
{
//$sql = " select * from $write_table where wr_is_comment = 0 $sql_order limit $from_record, $board[bo_page_rows] ";
$sql = " select * from $write_table where mb_id = '$member[mb_id]' and wr_is_comment = 0 $sql_order limit $from_record, $board[bo_page_rows] ";
}
$result = sql_query($sql);
$list = array();
$i = 0;
if (!$sca && !$stx)
{
$arr_notice = split("\n", trim($board[bo_notice]));
for ($k=0; $k<count($arr_notice); $k++)
{
$row = sql_fetch(" select * from $write_table where wr_id = '$arr_notice[$k]' ");
if (!$row[wr_id])
continue;
$list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);
$list[$i][is_notice] = true;
$i++;
}
}
$k = 0;
while ($row = sql_fetch_array($result))
{
// 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다
if ($sca || $stx)
$row = sql_fetch(" select * from $write_table where wr_id = '$row[wr_parent]' ");
$list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);
if (strstr($sfl, "subject"))
$list[$i][subject] = search_font($stx, $list[$i][subject]);
$list[$i][is_notice] = false;
$list[$i][num] = number_format($total_count - ($page - 1) * $board[bo_page_rows] - $k);
$i++;
$k++;
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "./board.php?bo_table=$bo_table".$qstr."&page=");
}
댓글 전체