MINI MINI MANI MO
<?
if(basename(__FILE__)==basename($_SERVER["PHP_SELF"])) die(__FILE__." ....");
if($_POST["search"] && $_POST["board_field"]){
	if($_POST["board_field"]=="date"){
		$where = " and from_unixtime(date,'%Y%m%d') like '%".$_POST["search"]."%' ";
	} else {
		$where = " and ".$_POST["board_field"]." like '%".$_POST["search"]."%'";
	}
}
?>
<?
$notice_qry=mysql_query("select * from $id where bdiv='$site_code' and notice='Y' $where ORDER by list desc,ridx asc limit 3");
$notice_cnt=0;
while($notice_row=mysql_fetch_array($notice_qry)){
?>
	<tr align="center">
		<td  height="60px">
		<?if($_SESSION[user_level]>=18){?>
		<input type='checkbox' name='chk[]' class="Chk" value="<?=$notice_row["no"]?>">
		<? } ?>
		</td>
		<td  height="60"><font color="red">공지</font></td>
		<td colspan="4">
            <?=$reply_gubun?>
            <a href="<?=$_SERVER['PHP_SELF']?>?id=<?=$id?>&mode=view&no=<?=$notice_row["no"]?>" class="board-title"><?=cut_str(strip_tags($notice_row["subject"]),45)?></a><br />
        <?=cut_str($notice_row["name"],5)?></font>
            <?=date("Y-m-d",$notice_row["date"])?></font>
            <font color='#545454'><?=$notice_row["ref"]?></font>
        </td>
	</tr>
<?
$notice_cnt++;
}
?>
<?
if (!$page) $page=1; //초기 페이지 설정
$nperpage=10-$notice_cnt;
$nperblock=10;
$sql = "  select * from $id where bdiv='$site_code' and notice!='Y' $where";
$result=@mysql_query($sql);
$trecord=@mysql_num_rows($result);
$tpage = ceil($trecord/$nperpage); //전체페이지
// 출력 레코드 범위
if($trecord==0) {
	$first=1;
	$last=0;
} else {
	$first=$nperpage*($page-1);
	$last=$nperpage*$page;
}
$p_qry = "  select * from $id where bdiv='$site_code' and notice!='Y' $where ORDER by list desc,ridx asc LIMIT $first, $nperpage";
$p_res = mysql_query($p_qry) or die(mysql_error());
$num_row = mysql_num_rows($p_res);
$article_num = $trecord - $nperpage*($page-1); //가상번호 설정
// 각 페이지로 직접 이동할 수 있는 페이지 링크에 대한 설정을 한다.
$tblock = ceil($tpage/$nperblock);
$block = ceil($page/$nperblock);
$first_page = ($block-1)*$nperblock;
$last_page = $block*$nperblock;
if($tblock <= $block) {
   $last_page = $tpage;
}
if(!($num_row+$notice_cnt)){
?>
	<tr> 
        <td colspan="6" height="60px" align="left" style="padding-left:10px;">게시글이 없습니다. </td>
    </tr>
<?
}else{
	$i=1;
	while($list = mysql_fetch_array($p_res)){
		$d_no=$list["no"]; //게시물고유번호
		$d_memo=$list["memo"]; //내용
		$d_name=$list["name"]; //작성자
		$d_subject=$list["subject"]; //제목
		$d_pwd=$list["pwd"]; //비밀번호
		$d_date=$list["date"]; //time()값
		$d_ref=$list["ref"]; //조회
		$d_list=$list["list"]; //게시물등록순서 / 등록시 max(no)+1
		$d_level=$list["level"]; // 0 - 원글 / 1 - 답글
		$d_ridx=$list["ridx"]; // 0 - 원글 / 1 - 답글
		$d_email=$list["email"]; // 이메일
		$d_userno=$list["midx"]; // 0 - ? / 2 - ?
		$d_html=$list["html"]; //html구분
		$d_security=$list["security"]; //비밀설정 Y,N
		$d_notice=$list["notice"]; //공지사항설정 Y,N
		$d_files=$list["files"]; 
		$d_files2=$list["files2"];
		$subject=cut_str(strip_tags($d_subject),45);
		$newdate=time()-60*60*24*1;
		if ($newdate < $d_date) $outnew="  <img src='/board/img/ico_new.gif' border=0 style='vertical-align:middle;display:inline;'>";
		else $outnew="";
		if($d_security=="Y"){
			$icon_sec="<img src='/board/img/secret.gif' border='0' style='display:inline;'>";
			if($u_admin){
				$passed="";
			} elseif($cookie_user_no==$d_userno) {
				$passed="";
			} else {
				$passed="pwview";
			}
		} else {
			$icon_sec="";
			$passed="";
		}
		$number=$article_num--;
		if($d_ridx==1){
/*			if($u_admin){
				$passed="";
			} else {
				$passed="pwview";
			} */
			$reply_gubun="  <img src='".$skinDir."img/re.gif' border=0 style='vertical-align:middle;display:inline;'> ";
		} else {
			$reply_gubun="";
		}
		if($d_files){
			$dfiles="<img src='/board/img/ico_file.gif' border='0' style='display:inline;'>";
		}else{
			$dfiles="";
		}
		$qry_board = "select * from admin_table where a_name='$id' ";
		$res_board = mysql_query($qry_board) or die(mysql_error());
		$data_board = mysql_fetch_array($res_board);
		
?>
	<tr>
		<td height="60px">
		<?if($_SESSION[user_level]>=18){?>
		<input type='checkbox' name='chk[]' class="Chk" value="<?=$d_no?>">
		<? } ?>
		</td>
		<td ><?=$number?></td>
		<td  height="60" colspan="4"><?=$reply_gubun?>
<? 
	if(($_SESSION[user_level]&&$_SESSION[user_level]>=$data_board[a_level])||$data_board[a_level]=="1"){
?>
		<a href="<?=$_SERVER['PHP_SELF']?>?id=<?=$id?>&mode=view&no=<?=$d_no?>&passed=<?=$passed?>"  class="board-title"><?=$subject?></a>
<?
	}else{
?>
		<a href="javascript:alert('열람할 권한이 없습니다');"  class="board-title"><?=$subject?></a>
<?
	}
?>
		<?=$dfiles?> <?=$outnew?> <?=$icon_sec?><br />
	    <div class="board-info">
            <span><?=cut_str($d_name,7)?></span>
            <span><?=date("Y-m-d",$d_date)?></span>
            <span><?=$d_ref?></span>
        </div>
        </td>
	</tr>
<?
	$i++;}
}
?>
</table>
<br />
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr> 
		<td align="left" width="33%">
			<?if($_SESSION[user_level]>=18){?>
                <button type="button" onclick="allDel()" class="btn btn-black-outline btn-sm">선택삭제</button>
				
			<?}?>
		</td>
        <td align="center" width="33%"><CENTER><?list_number();?></CENTER></td>
        <td align="right"  width="33%;">
			<?
			if($data[a_write_level]<=$_SESSION[user_level]){
				?>
				<?=$a_insert?><button type="button" class="btn btn-red-outline btn-sm">등록하기</button></a>
                
			<?
			}
			?>
		</td>
    </tr>
</table>
<input type="hidden" name="id" value="<?=$id?>">
<input type="hidden" name="url" value="id=<?=$id?>&page=<?=$_GET[page]?>&board_field=<?=$board_field?>&key=<?=$key?>">
</form>
<?
function list_number(){
global $page,$qcommon,$first_page,$nperblock,$direct_page,$block,$last_page,$tblock,$tpage;
// 첫번째 블록에 대한 링크
if($block > 1 && $tblock>2) {
   echo "<a href=\"$PHP_SELF?$qcommon&page=1\" onMouseOver=\"status='load previous $nperblock pages';return true;\" onMouseOut=\"status=''\"><font color='#976302'>◀처음|</font></a>   ";
} 
// 이전블록에 대한 링크
if($block > 1) {
	$imsi=$page;
   $page = $first_page;
   echo "<a href=\"$PHP_SELF?$qcommon&page=$page\" onMouseOver=\"status='load previous $nperblock pages';return true;\" onMouseOut=\"status=''\">[이전]</a>   ";
   $page=$imsi;
} 
// 페이지이동(블록내)
for($direct_page = $first_page+1; $direct_page <= $last_page; $direct_page++) {
   if($page == $direct_page) {
      echo "<FONT SIZE=3 COLOR=red>$direct_page</FONT>";
   } else {
      echo "<a href=\"$PHP_SELF?$qcommon&page=$direct_page\" onMouseOver=\"status='jump to page $direct_page';return true;\" onMouseOut=\"status=''\">[$direct_page]</a>";
   }
}
//$list_bottom=str_replace("[number]",$tmp_list_bottom,$list_bottom);
// 다음블록에 대한 링크
if($block < $tblock) {
   $page = $last_page+1;
   echo "   <a href=\"$PHP_SELF?$qcommon&page=$page\" onMouseOver=\"status='load next $nperblock pages';return true;\" onMouseOut=\"status=''\">[다음]</a>";
} 
//마지막 블록에 대한 링크
if($block < $tblock && $tblock>2) {
$final_page=($tblock*10)-9;
 echo "   <a href=\"$PHP_SELF?$qcommon&page=$final_page\" onMouseOver=\"status='load next $nperblock pages';return true;\" onMouseOut=\"status=''\"><font color='#976302'>|마지막▶</font></a>";
}
}
?>
 OHA YOOOO