<?
//로그인확인
include $_SERVER[DOCUMENT_ROOT] . "/module/member/auth.php";

//DB연결
$dblink = SetConn($_conf_db["main_db"]);

$arrInfo = getUserInfo($_SESSION[$_SITE["DOMAIN"]]["MEMBER"]["ID"]);

//DB해제
SetDisConn($dblink);

$arrEmail = explode("@",$arrInfo["list"][0][email]);
$arrPhone = explode("-",$arrInfo["list"][0][phone]);
$arrMobile = explode("-",$arrInfo["list"][0][mobile]);
$arrBirth = explode("-",$arrInfo["list"][0][birth]);
$arrZip = explode("-",$arrInfo["list"][0][zip]);
$arrTel = explode("-",$arrInfo["list"][0][regnum1]);
?>
<script language="javascript">
jQuery(function($) {
	$("form[name=memberForm]").submit(function() {
		var returnval = true;
		$(".required").each(function() {
			if ($.trim($(this).val()) == "") {
				alert($(this).attr("title")+" 입력은 필수입니다");
				$(this)
				.removeAttr('checked')
				.removeAttr('selected')
				.not(':button, :submit, :reset, :hidden, :radio, :checkbox')
				.val('')
				.focus();
				returnval = false;
				return false;
			}
		});
		if (returnval == false) {
			return false;
		}

		if ($(".lengthcheck").length) {
			if ($(this).val().length < $(this).attr("minlength") || $(this).val().length > $(this).attr("maxlength")) {
				alert($(this).attr("title") + " 길이를 "+$(this).attr("minlength")+"~"+$(this).attr("maxlength")+" 사이로 입력해주십시오");
				$(this).focus();
				return false;
			}
		}

		if ($("input[name=dupcheck]").val() == "") {
			alert("아이디 중복체크는 필수 입니다");
			$(".idchecker").focus();
			return false;
		}

		if ($("input[name=user_pw]").val() != $("input[name=user_pw2]").val()) {
			alert("비밀번호가 일치하지 않습니다");
			//$("input[name=user_pw]").val("");
			//$("input[name=user_pw2]").val("");
			$("input[name=user_pw2]").focus();
			return false;
		}
		if ($("input[name=user_id]").val() == $("input[name=user_pw]").val()) {
			alert("아이디와 비밀번호가 동일합니다");
			$("input[name=user_pw]").val("");
			$("input[name=user_pw]").focus();
			return false;
		}
	});
});

function setEmailDom(frm,val){
	frm.email_domain.value = val;
	if(val==""){
		frm.email_domain.focus();
	}
}
</script>
		<div class="sub-title">			
			<h2>회원정보수정</h2>
			<div class="path">HOME &gt; 마이페이지 &gt; <strong>회원정보수정</strong></div>
		</div>
		<div class="real-cont">		
			<form name="memberForm" method="post" action="/module/member/member_evn.php" ENCTYPE="multipart/form-data" onsubmit="return checkForm(this)">
			<input type="hidden" name="evnMode" value="edit">
			<input type="hidden" name="user_id" value="<?=$_SESSION[$_SITE["DOMAIN"]]["MEMBER"]["ID"]?>">
				<div class="join-area">
				<h3>기본정보</h3>
				<p>허위로 작성된 가입정보일 경우 임의로 삭제처리될 수 있으니 주의해 주세요.</p>
				<div class="form">
					<table summary="개인회원 회원정보를 입력 하세요 " >
						<caption>회원정보입력 개인회원</caption>
						<colgroup>
							<col width="140" />
							<col width="*" />
						</colgroup>
						<tbody>
							
							<tr>
								<th scope="row"><label for="userid">아이디</label></th>
								<td><?=$_SESSION[$_SITE["DOMAIN"]]["MEMBER"]["ID"]?></td>
							</tr>							
							<tr>
								<th><label for="pwd">비밀번호</label></th>
								<td>
									<input id="pwd" name="user_pw" class="input required" title="비밀번호" type="password" value="" style="width:200px;" />
									&nbsp;&nbsp;<span class="txt">영문, 숫자포함 6~15자이상 입력하세요.</span>
								</td>
							</tr>
							<tr>
								<th><label for="user_pw2">비밀번호 확인</label></th>
								<td><input type="password" id="user_pw2" name="user_pw2" class="input required" title="비밀번호확인" style="width:200px;" /></td>
							</tr>
							<tr>
								<th><label for="username">이름</label></th>
								<td><?=$_SESSION[$_SITE["DOMAIN"]]["MEMBER"]["NAME"]?></td>
							</tr>		
							<tr>
								<th><label for="sexMale">성별</label></th>
								<td>
									<input type="radio" id="sexMale" name="sex" value="M" <?=$arrInfo["list"][0][sex]=="M"?"checked":""?>/><label for="sexMale">남자</label> &nbsp;&nbsp;
									<input type="radio" id="sexFemale" name="sex" value="F" <?=$arrInfo["list"][0][sex]=="F"?"checked":""?>/><label for="sexFemale">여자</label>
								</td>
							</tr>
							<tr>
								<th><label for="birthYear">생년월일</label></th>
								<td>
									<input id="birthYear" name="byear" class="input required" name="byear" title="생년" type="text" value="<?=$arrBirth[0]?>" style="width:80px;" />년 
									<input id="birthMonth" name="bmonth" class="input required" title="월" type="text" value="<?=$arrBirth[1]?>" style="width:40px;" />월 
									<input id="birthDay" name="bday" class="input required" title="일" type="text" value="<?=$arrBirth[2]?>" style="width:40px;" />일
								</td>
							</tr>
							<!--
							<tr>
								<th><label for="birthYear">생년월일</label></th>
								<td>
									<select name="byear" class="select input" title="생년월일">
										<option value="">선택하세요</option>
										<? for($i=1930;$i<date("Y")-12;$i++) {?>
										<option value="<?=$i?>" <?=$arrBirth[0]==$i?"selected":""?>><?=$i?></option>
										<?}?>
									</select>년
									<select name="bmonth" class="select input" title="생년월일">
										<option value="">선택하세요</option>
										<? for($i=1;$i<13;$i++) {
												if($i<10) $i = "0".$i;
										?>
										<option value="<?=$i?>" <?=$arrBirth[1]==$i?"selected":""?>><?=$i?></option>
										<?}?>
									</select>월
									<select name="bday" class="select input" title="생년월일">
										<option value="">선택하세요</option>
										<? for($i=1;$i<32;$i++) {
												if($i<10) $i = "0".$i;
										?>
										<option value="<?=$i?>" <?=$arrBirth[2]==$i?"selected":""?>><?=$i?></option>
										<?}?>
									</select>일&nbsp;&nbsp; 
									<input name="solar" type="radio" value="S" class="inputRadio" <?=$arrInfo["list"][0]["solar"]=="S"?"checked":""?> /> 양력 
									<input name="solar" type="radio" value="L" class="inputRadio" <?=$arrInfo["list"][0]["solar"]=="L"?"checked":""?> /> 음력
								</td>
							</tr>
							-->
							<tr>
								<th>주소</th>
								<td>
									<div class="mgb5">
									<input type="text" id="postcode" name="zip" placeholder="우편번호" class="input required" style="width:100px;" maxlength="5" readonly value="<?=$arrInfo["list"][0][zip]?>" title="우편번호">
									<a href="javascript:execDaumPostcode();" class="btn-pack medium" title="우편번호검색 - 새창열림">우편번호검색</a>
									</div>
									<div class="mgb5">
									<input type="text" name="address" id="address" title="주소 상세주소" class="input required" style="width:98%;" value="<?=$arrInfo["list"][0][address]?>" />
									</div>
									<div>
									<input type="text" name="address_ext" id="address2" title="주소 상세주소" class="input required" style="width:98%;" value="<?=$arrInfo["list"][0][address_ext]?>" />
									</div>
								</td>
							</tr>
							<tr>
								<th><label for="tel1">전화번호</label></th>
								<td>
								<input id="tel1" name="phone_1" type="text" title="전화번호 국번" maxlength="4" class="input" style="width:50px;" value="<?=$arrPhone[0]?>" /> 
								 - <input id="tel2" name="phone_2" type="text" title="전화번호 앞자리" maxlength="4" class="input" style="width:50px;" value="<?=$arrPhone[1]?>" />  
								 - <input id="tel3" name="phone_3"  type="text" title="전화번호 뒷자리" maxlength="4" class="input" style="width:50px;" value="<?=$arrPhone[2]?>" />
								</td>
							</tr>
							<tr>
								<th><label for="phone1">휴대폰번호</label></th>
								<td>
								<input id="phone1" name="mobile_1" type="text" title="휴대폰번호 국번" maxlength="4" class="input required" style="width:50px;" value="<?=$arrMobile[0]?>" /> 
								 - <input id="phone2" name="mobile_2" type="text" title="휴대폰번호 앞자리" maxlength="4" class="input required" style="width:50px;" value="<?=$arrMobile[1]?>" />  
								 - <input id="phone3" name="mobile_3"  type="text" title="휴대폰번호 뒷자리" maxlength="4" class="input required" style="width:50px;" value="<?=$arrMobile[2]?>" />
								</td>
							</tr>
							<tr>
								<th><label for="email_id">E-mail</label></th>
								<td>
									<input id="email_id" name="email_id" class="input required" title="전자메일아이디" type="text" value="<?=$arrEmail[0]?>" style="width:150px;" /> @ <input id="email_domain" name="email_domain" class="input required" title="전자메일계정" type="text" value="<?=$arrEmail[1]?>" style="width:150px;" />
									<select name="email_list" id="email_list" class="select" onChange="setEmailDom(this.form, this.value);">
										<option value="">직접입력</option>
										<option value="naver.com">naver.com</option>
										<option value="chol.com">chol.com</option>
										<option value="dreamwiz.com">dreamwiz.com</option>
										<option value="empal.com">empal.com</option>
										<option value="freechal.com">freechal.com</option>
										<option value="gmail.com">gmail.com</option>
										<option value="hanafos.com">hanafos.com</option>
										<option value="hanmail.net">hanmail.net</option>
										<option value="hanmir.com">hanmir.com</option>
										<option value="hitel.net">hitel.net</option>
										<option value="hotmail.com">hotmail.com</option>
										<option value="korea.com">korea.com</option>
										<option value="lycos.co.kr">lycos.co.kr</option>
										<option value="nate.com">nate.com</option>
										<option value="netian.com">netian.com</option>
										<option value="paran.com">paran.com</option>
										<option value="yahoo.com">yahoo.com</option>
										<option value="yahoo.co.kr">yahoo.co.kr</option>
									</select>
								</td>
							</tr>
							<tr>
								<th><label for="emailYes">메일수신여부</label></th>
								<td>
									<input type="radio" id="emailYes" name="email_accept" class="inputRadio" value="Y" <?=$arrInfo["list"][0]["email_accept"]=="Y"?"checked":""?> /><label for="emailYes">메일수신을 받습니다.</label>&nbsp;&nbsp;
									<input type="radio" id="emailNo" name="email_accept" class="inputRadio" value="N" <?=$arrInfo["list"][0]["email_accept"]=="N"?"checked":""?> /><label for="emailNo">메일수신을 받지않습니다.</label>
								</td>
							</tr>							
						</tbody>
					</table>
				</div>
				
				<div class="buttons">
					<div class="cen">
						<input type="submit" value="수정완료" class="btn-pack xlarge focus">
					</div>
				</div>
			</div>
            </form>

		</div>
