<?php

	include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
	include $_SERVER['DOCUMENT_ROOT'].ADMIN_PATH.'common/auth_chk.php';

	$mp = "20";	//set top nav

?>
<? include("../inc/inc_top.php") ?>
<? include("../inc/inc_header.php") ?>

<?
	$cd_user = $_REQUEST["cd_user"];

	$sql ="SELECT
				*
				FROM member_master
				WHERE cd_user='$cd_user' AND ds_delind='N'";

	$mode = "Add";

	$col=mysql_fetch_array(mysql_query($sql));
	if (!empty($col['cd_user'])){
		$cd_user = $col['cd_user'];
		$cd_userid = $col['cd_userid'];
		$nm_email = $col['nm_email'];
		$nm_pass = $col['nm_pass'];
		$nm_join = $col['nm_join'];
		$ds_type = $col['ds_type'];
		$ds_level = $col['ds_level'];
		$nm_birth = $col['nm_birth'];
		$nm_name = $col['nm_name'];
		$nm_company = $col['nm_company'];
		$nm_hp = $col['nm_hp'];
		$nm_hp_01 = $col['nm_hp_01'];
		$nm_hp_02 = $col['nm_hp_02'];
		$nm_hp_03 = $col['nm_hp_03'];
		$nm_tel = $col['nm_tel'];
		$nm_tel_01 = $col['nm_tel_01'];
		$nm_tel_02 = $col['nm_tel_02'];
		$nm_tel_03 = $col['nm_tel_03'];
		$nm_fax = $col['nm_fax'];
		$nm_fax_01 = $col['nm_fax_01'];
		$nm_fax_02 = $col['nm_fax_02'];
		$nm_fax_03 = $col['nm_fax_03'];
		$nm_zip = $col['nm_zip'];
		$nm_addr = $col['nm_addr'];
		$nm_addr_sub = $col['nm_addr_sub'];
		$ds_area = $col['ds_area'];
		$ds_area_sub = $col['ds_area_sub'];
		$nm_etc_01 = $col['nm_etc_01'];
		$nm_etc_02 = $col['nm_etc_02'];
		$nm_etc_03 = $col['nm_etc_03'];
		$nm_etc_04 = $col['nm_etc_04'];
		$nm_etc_05 = $col['nm_etc_05'];
		$ds_agree1 = $col['ds_agree1'];
		$ds_agree2 = $col['ds_agree2'];
		$ds_agree3 = $col['ds_agree3'];
		$ds_agree4 = $col['ds_agree4'];
		$ds_agree5 = $col['ds_agree5'];
		$ds_status = $col['ds_status'];
		$ds_status_agree = $col['ds_status_agree'];
		$dt_insert = $col['dt_insert'];
		$nm_insert = $col['nm_insert'];
		$dt_update = $col['dt_update'];
		$nm_update = $col['nm_update'];
		$dt_delind = $col['dt_delind'];
		$nm_delind = $col['nm_delind'];
		$ds_delind = $col['ds_delind'];
	/*
		$arr_nm_info1 = explode("-",$nm_info1);
		if(count($arr_nm_info1) == 3){
			$nm_info11 = $arr_nm_info1['0'];
			$nm_info12 = $arr_nm_info1['1'];
			$nm_info13 = $arr_nm_info1['2'];
		}else{
			$nm_info11 = "";
			$nm_info12 = "";
			$nm_info13 = "";
		}

		$arr_nm_info3 = explode("@",$nm_info3);
		if(count($arr_nm_info3) == 2){
			$nm_info31 = $arr_nm_info3['0'];
			$nm_info32 = $arr_nm_info3['1'];
		}else{
			$nm_info31 = "";
			$nm_info32 = "";
		}
		$nm_info3 = $col['nm_info3'];
	*/
		$mode = "Update";
	}else{
		$ds_level = "1";
	}

	$totalrows = @mysql_result(mysql_query("select count(*) from admin_info WHERE ds_delind='N'"),0,0);
?>

<section id="contents">
	<h2>일반회원 관리</h2>

<? include("../inc/inc_header_member.php") ?>

	<h3><em>▶</em> 문의내역</h3>
	<div class="tbl_wrap">
		<table class="tbl_list ty2">
			<colgroup>
				<col width="7%">
				<col width="*">
				<col width="13%">
				<col width="13%">
			</colgroup>
			<thead>
			<tr>
				<th>번호</th>
				<th>제목</th>
				<th>작성일</th>
				<th>답변여부</th>
			</tr>
			</thead>
<?
	$cd_board = "02";
	$ds_kind = "A";
	$cd_user = $_REQUEST["cd_user"];

	if (empty($PageNo)) {$PageNo=1;}else{$PageNo=$PageNo;}
	$PageSize=2; //목록개수설정
	$pagestartpoint=($PageNo-1)*$PageSize;
	$sql = "where cd_board='$cd_board' and ds_delind='N'";
	$sql = $sql." and ds_kind='$ds_kind' ";
	$sql = $sql." and cd_user='$cd_user' ";

	if($searchword != ""){
		if($searchtype=="" || $searchtype==null){
			$sql = $sql. "	and (nm_title like '$searchword%' or nm_content like '$searchword%' or cd_userid like '$searchword%')";
		}else{
			$sql = $sql. "	and $searchtype like '$searchword%'";
		}
	}

	$totalrows = @mysql_result(mysql_query("select count(*) from board_master $sql"),0,0);

		if($totalrows>0) {
			$r = mysql_query("SELECT * FROM board_master  $sql ORDER BY ds_top desc, no_famally ASC, no_order ASC  LIMIT 0,2");
			$i=1;
			while($col = mysql_fetch_array($r)) {
				$date = strtotime ($col[dt_insert]);
				$view_date = strtotime ("-1 day",time());
				if($date >= $view_date) {
					$newicon = " <img src='".ADMIN_PATH."img/i_new.gif' style='margin-top:1px;' /> ";
				} else {
					$newicon = "";
				}

				if($col[no_step]>0){
					$padding = $col[no_step] * 8;
					$step = "<span style=\"padding-left:".$padding."px\"/>";
				}

				$tmpNum =$totalrows-($PageSize*($PageNo-1));
				$no = ($tmpNum - $i)+1;

?>

			<tr onclick="location.href='./member_view5_detail.php?cd_board=<?=$cd_board?>&ds_kind=<?=$ds_kind?>&cd_seq=<?=$col[cd_seq]?>&cd_user=<?=$cd_user?>&PageNo=1';" style="cursor: pointer; cursor: hand;">
				<td><?=$no?></td>
				<? if($cd_board=="99"){?>
				<td width="10%" align="center" class="list03"><img src="<?=UPLOAD_PATH?>board/board_<?=$cd_board?>/<?=$col[nm_file]?>" width="50"/></td>
				<?}?>
				<td class="subject"><?=text_cut($col[nm_title],50)?></td>
				<td><?=$col[dt_insert]?></td>
				<? if($cd_board=="02"){?>
				<td><?=($col[nm_reply] == "") ? "미답변" : "답변완료" ?></td>
				<?}?>
			</tr>
<?
	$i++;
}
}else{
?>
			<tr>
				<td colspan="4">등록된 정보가 없습니다.</td>
			</tr>
<?
}
?>
		</table>
	</div>

	<div class="paging">
		<?
				$url = "./member_view5.php?searchtype=$searchtype&searchword=$searchword&dt_start=$dt_start&dt_end=$dt_end&cd_user=$cd_user";
				ListPg1($url ,$PageNo,$PageSize,10,$totalrows,$leftboard[1],$rootpath);
		?>
	</div>

</section>

<? include("../inc/inc_footer.php") ?>
<? include("../inc/inc_bottom.php") ?>
<?
mysql_close($connect);
?>
