<!--#include virtual = "/common/lib/dbcon.asp" -->
<!--#include virtual = "/common/lib/func.asp" -->

<!--#include file = "config.asp" -->

<%

R_Fields = "m_num, m_id, m_pwd, m_name, m_nickname, m_jumin1, m_jumin2, m_zip1, m_zip2, m_addr1, m_addr2, m_phone1, m_phone2, m_phone3, m_email, m_mobile1, m_mobile2, m_mobile3, m_fax1, m_fax2, m_fax3, m_homepage, m_autoimg_str, m_temp1, m_temp2, m_temp3, m_secede_date, m_point, m_sex, m_birth_Y, m_birth_M, m_birth_D, m_sms, m_mailing, m_marry, m_marrydate_Y, m_marrydate_M, m_marrydate_D, m_job, m_text, autoimg_str, m_recom_id, m_level, bdm_idx"

Call RequestAll (R_Fields, "")

m_text = InputValue2(request("m_text"))


'회원환경설정
R_Fields = "mc_idx, mc_addr, mc_nickname, mc_phone, mc_mobile, mc_email, mc_homepage, mc_joinlevel, mc_wdate, mc_jumin, mc_mailing, mc_sms, mc_sex, mc_birth, mc_fax, mc_marry, mc_marrydate, mc_job, mc_text, mc_recom, mc_recom_point, mc_new_point"
R_tablename_str = "member_config"
R_WHERE_str = " WHERE mc_idx=1"
Call SelectQuery(R_Fields, R_tablename_str, R_WHERE_str)



if mc_jumin = "Y" then	m_jumin	= m_jumin1 & m_jumin2
if mc_addr = "Y" then	m_zipcode = m_zip1 & m_zip2
if mc_birth = "Y" then	m_birth	= m_birth_Y & "-" & Right("00"&m_birth_M,2) & "-" & Right("00"&m_birth_D,2)
if mc_marrydate = "Y" then	m_marrydate	= m_marrydate_Y & "-" & Right("00"&m_marrydate_M,2) & "-" & Right("00"&m_marrydate_D,2)

m_temp3	= "0"	'탈퇴여부




if m_num = "" then '저장

	
	' 자동가입방지 체크
	' *****************************************
	Select Case autoimg_str		
		case 1  : autoimg_chk = "DF4PH3"
		case 2  : autoimg_chk = "HS42YP"
		case 3  : autoimg_chk = "S8VP3X"
		case 4  : autoimg_chk = "N4CW2U"
		case 5  : autoimg_chk = "9SK6GR"
	End select
	

	If (ucase(autoimg_chk) <> ucase(m_autoimg_str))  Then
		Call Back_back("자동가입방지입력값이 동일하지 않습니다.")
	End if
	' *****************************************

	
	If mc_jumin = "Y" then

		' 동일주민번호 체크
		' *****************************************
		sql = "select count(m_num) as jumin_chk from member WHERE m_jumin='"& m_jumin &"'"
		Set Rs = Dbcon.Execute (sql)
		If rs("jumin_chk") Then
			Call Back_back("동일한 주민번호가 존재합니다.")
		End If
		rs.close : Set rs = nothing
		' *****************************************
	End if



	' 동일아이디 체크
	' *****************************************
	sql = "select count(m_num) as id_chk from member where m_id='"&m_id&"'"
	Set Rs = Dbcon.Execute (sql)
	If rs("id_chk") Then
		Call Back_back("동일한 아이디가 존재합니다.")
	End If
	rs.close : Set rs = nothing	
	' *****************************************


	R_Fields_i = "m_id, m_pwd, m_name, m_date, m_modymate, m_lastdate, m_chuchun, m_ip, m_level, m_autoimg_str, m_temp1, m_temp2, m_temp3, bdm_idx"

	if  mc_nickname="Y" then	R_Fields_i = R_Fields_i& ", m_nickname"
	if  mc_jumin="Y" then		R_Fields_i = R_Fields_i& ", m_jumin"
	if  mc_addr="Y" then		R_Fields_i = R_Fields_i& ", m_zipcode, m_addr1, m_addr2"
	if  mc_phone="Y" then		R_Fields_i = R_Fields_i& ", m_phone1, m_phone2, m_phone3"
	if  mc_email="Y" then		R_Fields_i = R_Fields_i& ", m_email"
	if  mc_mobile="Y" then		R_Fields_i = R_Fields_i& ", m_mobile1, m_mobile2, m_mobile3"
	if  mc_fax="Y" then			R_Fields_i = R_Fields_i& ", m_fax1, m_fax2, m_fax3"
	if  mc_sex="Y" then			R_Fields_i = R_Fields_i& ", m_sex"
	if  mc_birth="Y" then		R_Fields_i = R_Fields_i& ", m_birth"
	if  mc_sms="Y" then			R_Fields_i = R_Fields_i& ", m_sms"
	if  mc_mailing="Y" then		R_Fields_i = R_Fields_i& ", m_mailing"
	if  mc_marry="Y" then		R_Fields_i = R_Fields_i& ", m_marry"
	if  mc_marrydate="Y" then	R_Fields_i = R_Fields_i& ", m_marrydate"
	if  mc_job="Y" then			R_Fields_i = R_Fields_i& ", m_job"
	if  mc_text="Y" then		R_Fields_i = R_Fields_i& ", m_text"
	if  mc_homepage="Y" then	R_Fields_i = R_Fields_i& ", m_homepage"


	m_date		= getDateFm(now,3)
	m_modymate	= getDateFm(now,3)
	m_ip		= Request.ServerVariables("Remote_host")


	Call InsertQuery (R_Fields_i, "member")

	' ─────── 회원가입 메일 발송 ───────
'	call mail_new_member(m_id)
	' ──────────────────────────────────

	'If ok_url = "" Then ok_url = "write.asp"
	If ok_url = "" Then ok_url = "list.asp"


Else '수정

	R_Fields_u = "m_pwd, m_modymate, m_temp1, m_temp2, m_temp3, m_level, bdm_idx"

	if mc_nickname="Y" then		R_Fields_u = R_Fields_u & ", m_nickname"
	if mc_addr="Y" then			R_Fields_u = R_Fields_u & ", m_zipcode, m_addr1, m_addr2"
	if mc_phone="Y" then		R_Fields_u = R_Fields_u & ", m_phone1, m_phone2, m_phone3"
	if mc_email="Y" then		R_Fields_u = R_Fields_u & ", m_email"
	if mc_mobile="Y" then		R_Fields_u = R_Fields_u & ", m_mobile1, m_mobile2, m_mobile3"
	if mc_fax="Y" then			R_Fields_u = R_Fields_u & ", m_fax1, m_fax2, m_fax3"
	if mc_sex="Y" then			R_Fields_u = R_Fields_u & ", m_sex"
	if mc_birth="Y" then		R_Fields_u = R_Fields_u & ", m_birth"
	if mc_sms="Y" then			R_Fields_u = R_Fields_u & ", m_sms"
	if mc_mailing="Y" then		R_Fields_u = R_Fields_u & ", m_mailing"
	if mc_marry="Y" then		R_Fields_u = R_Fields_u & ", m_marry"
	if mc_marrydate="Y" then	R_Fields_u = R_Fields_u & ", m_marrydate"
	if mc_job="Y" then			R_Fields_u = R_Fields_u & ", m_job"
	if mc_text="Y" then			R_Fields_u = R_Fields_u & ", m_text"
	if mc_homepage="Y" then		R_Fields_u = R_Fields_u & ", m_homepage"
	if mc_jumin="Y" and m_jumin<>"" Then R_Fields_u = R_Fields_u& ", m_jumin"
	
	m_modymate = getDateFm(now,3)

	Call UpdateQuery (R_Fields_u, "member", "where m_num=" & m_num)

	If ok_url = "" Then ok_url = "list.asp?m_num=" & m_num&"&amp;"&page_info

End if
Call loding ("0",ok_url)

%>
