bbs_list.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?php
  2. include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
  3. include $_SERVER['DOCUMENT_ROOT'].ADMIN_PATH.'common/auth_chk.php';
  4. if($cd_board == "01"){$mp="50";}else if($cd_board == "02"){$mp="51";}else if($cd_board == "03"){$mp="52";}else{$mp="53";};
  5. if($cd_board<>"01" && $cd_board <> "03" && $cd_board <> "02" && $cd_board <> "04"){
  6. AlertRedirect("잘못된 요청입니다.","/index.php");
  7. }
  8. if (empty($PageNo)) {$PageNo=1;}else{$PageNo=$PageNo;}
  9. $PageSize=10; //목록개수설정
  10. $pagestartpoint=($PageNo-1)*$PageSize;
  11. $sql = "where cd_board='$cd_board' and ds_delind='N'";
  12. if($searchword != ""){
  13. if($searchtype=="" || $searchtype==null){
  14. $sql = $sql. " and (nm_title like '$searchword%' or nm_content like '$searchword%' or cd_userid like '$searchword%')";
  15. }else{
  16. $sql = $sql. " and $searchtype like '$searchword%'";
  17. }
  18. }
  19. $totalrows = @mysql_result(mysql_query("select count(*) from board_master $sql"),0,0);
  20. ?>
  21. <? include("../inc/inc_top.php") ?>
  22. <? include("../inc/inc_header.php") ?>
  23. <section id="contents">
  24. <h2>커뮤니티</h2>
  25. <h3><em>▶</em> <?=fnGetBbsTitle($cd_board)?></h3>
  26. <div class="tbl_wrap">
  27. <table class="tbl_list">
  28. <colgroup>
  29. <col width="7%">
  30. <col width="*">
  31. <col width="13%">
  32. <col width="13%">
  33. <? if($cd_board=="02"){?>
  34. <col width="13%">
  35. <?}?>
  36. </colgroup>
  37. <thead>
  38. <tr>
  39. <th>번호</th>
  40. <th>제목</th>
  41. <th>작성자</th>
  42. <th>등록일</th>
  43. <? if($cd_board=="02"){?>
  44. <th>답변여부</th>
  45. <?}?>
  46. </tr>
  47. </thead>
  48. <!--form id="frmSearch" name="frmSearch" method="post" action="<?=ADMIN_PATH?>/board/bbs_list.php">
  49. <input type="hidden" name="cd_board" id="cd_board" value="<?=$cd_board?>"/>
  50. <table width="330" border="0" cellpadding="0" cellspacing="0">
  51. <tr>
  52. <td width="70px;" style="font-weight:bold;">
  53. 검색조건
  54. </td>
  55. <td width="80px;">
  56. <select name="searchtype" id="searchtype">
  57. <option value="">전체</option>
  58. <option value="nm_title" <? if($searchtype =="nm_name"){?>selected<?}?>>제목</option>
  59. <option value="nm_content" <? if($searchtype =="nm_content"){?>selected<?}?>>내용</option>
  60. </select>
  61. </td>
  62. <td width="*" style="padding-left:5px;"><input id="searchword" name="searchword" type="text" size="20" class="input_txt" value="<?=$searchword?>"/></td>
  63. <td width="50px;"><input type="button" value="검색" class="btnAdmin" style="width:40px;" id="btnSearch" onclick="fnSearch();"/></td>
  64. </tr>
  65. </table>
  66. </form-->
  67. <?
  68. if($totalrows>0) {
  69. $r = mysql_query("SELECT * FROM board_master $sql ORDER BY ds_top desc, no_famally ASC, no_order ASC LIMIT $pagestartpoint,$PageSize");
  70. $i=1;
  71. while($col = mysql_fetch_array($r)) {
  72. $date = strtotime ($col['dt_insert']);
  73. $view_date = strtotime ("-1 day",time());
  74. if($date >= $view_date) {
  75. $newicon = " <img src='".ADMIN_PATH."img/i_new.gif' style='margin-top:1px;' /> ";
  76. } else {
  77. $newicon = "";
  78. }
  79. if($col['no_step']>0){
  80. $padding = $col['no_step'] * 8;
  81. $step = "<span style=\"padding-left:".$padding."px\"/>";
  82. }
  83. $tmpNum =$totalrows-($PageSize*($PageNo-1));
  84. $no = ($tmpNum - $i)+1;
  85. ?>
  86. <tr onclick="location.href='./bbs_view.php?cd_board=<?=$cd_board?>&cd_seq=<?=$col['cd_seq']?>&PageNo=<?=$PageNo?>';" style="cursor: pointer; cursor: hand;">
  87. <td><?=$no?></td>
  88. <? if($cd_board=="99"){?>
  89. <td width="10%" align="center" class="list03"><img src="<?=UPLOAD_PATH?>board/board_<?=$cd_board?>/<?=$col['nm_file']?>" width="50"/></td>
  90. <?}?>
  91. <td class="subject"><?=text_cut($col['nm_title'],50)?></td>
  92. <td><?=$col['nm_name']?></td>
  93. <td><?=$col['dt_insert']?></td>
  94. <? if($cd_board=="02"){?>
  95. <td><?=($col['nm_reply'] == "") ? "미답변" : "답변완료" ?></td>
  96. <?}?>
  97. </tr>
  98. <?
  99. $i++;
  100. }
  101. }else{
  102. ?>
  103. <tr>
  104. <td colspan="4">등록된 정보가 없습니다.</td>
  105. </tr>
  106. <?
  107. }
  108. ?>
  109. </table>
  110. </div>
  111. <div class="paging">
  112. <?
  113. $url = ADMIN_PATH."board/bbs_list.php?cd_board=$cd_board&searchtype=$searchtype&searchword=$searchword";
  114. ListPg1($url ,$PageNo,$PageSize,10,$totalrows,$leftboard[1],$rootpath);
  115. ?>
  116. </div>
  117. <?
  118. if($cd_board != "02"){
  119. ?>
  120. <div class="btn_right">
  121. <a href="./bbs_write.php?cd_board=<?=$cd_board?>" class="rnd_btn gray">등록하기</a>
  122. </div>
  123. <?
  124. }
  125. ?>
  126. </section>
  127. <script language="javascript" type="text/javascript">
  128. function fnSearch(){
  129. if($("#searchtype").val()!="" && $("#searchword").val()==""){
  130. alert("검색어를 입력하세요");
  131. return false;
  132. }
  133. $("#frmSearch").submit();
  134. }
  135. </script>
  136. <? include("../inc/inc_footer.php") ?>
  137. <? include("../inc/inc_bottom.php") ?>
  138. <?
  139. mysql_close($connect);
  140. ?>