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


proc_mode = inputValue( request.queryString("proc_mode") )
'//파라미터정보 *************************************************************************************
b_num		= InputValue( request("b_num") )
b_type		= InputValue( request("b_type") )
'//**************************************************************************************************

'response.write proc_mode
'response.end

If is_write <> "Y" Then Call goMessage_board("접근권한이 없습니다.", Request.ServerVariables("HTTP_REFERER"), "", "", a_num)

If is_ad_cms <> "Y" Then b_name_readonly = " readonly='readonly' "

If proc_mode = "" Then proc_mode = "write"

If proc_mode = "write" Then
	
	'//폴더 없으면 새로 생성
	strDirectory		= server.mappath("/data/board/") & "\" & a_tablename& "\"
	Call FolderCreate( strDirectory )
	
	If a_jumin = "Y" And a_jumin_opt = "2" and is_ad_cms <> "Y" And (SESSION("ss_m_name") = "" Or SESSION("ss_m_jumin") = "") Then		'주민번호사용이고 실명제일때
	
		response.redirect "name.asp?a_num=" & a_num & "&prepage=" & server.urlencode( Request.ServerVariables("path_info") & "?" & Request.ServerVariables("query_string") )
		response.end

	End if



	'//비밀번호인증일때
	If a_password = "Y" and is_ad_cms = "Y" then
		
		If SESSION("ss_pwd_chk2_" & a_num) <> "YY" then

			Call locationhref("a_pwd.asp?a_num=" & a_num)

		End if
	End If
	
	

	'//관리자일때 비번을 입력하지 않는다..
	b_name		= SESSION("ss_m_name")
	b_pwd		= SESSION("ss_m_pwd")
	b_jumin		= SESSION("ss_m_jumin")

	If b_name <> "" And is_ad_cms <> "Y" Then
		readonly = "readonly='readonly'"
	End if

	'//-------------------------------------------------------------------------------------------

	If a_level = "nninc_simple" Then
	%><!--#include virtual="/content/board/nninc_simple/inc_write.asp"--><%
	ElseIf a_level = "default_photo" Then
	%><!--#include virtual="/content/board/default_photo/inc_write.asp"--><%
	ElseIf a_level = "default_calendar" Then
	%><!--#include virtual="/content/board/default_calendar/inc_write.asp"--><%
	ElseIf a_level = "nninc_qna" Then
	%><!--#include virtual="/content/board/nninc_qna/inc_write.asp"--><%
	ElseIf a_level = "nninc_faq" Then
	%><!--#include virtual="/content/board/nninc_faq/inc_write.asp"--><%	
	End if



	'//세션 소멸
	SESSION("pwd_chk_" & a_num & "_" & b_num) = ""


else
	Dim R_Fields, UploadForm
	Dim b_num, b_type, b_id, b_name, b_pwd, b_subject, b_email, b_jumin, b_phone1, b_phone2, b_phone3, b_noticechk, b_ip, b_count, b_look, b_open, b_ref, b_step, b_level, b_regdate, b_chuchun, b_sbjclr, b_temp1, b_temp2, b_temp3, b_temp4,b_temp5, b_temp6, b_temp7, b_file1, b_file2, b_file3, b_file4, b_file5,b_keyword,w_mode, b_cate_tot
	Dim b_sdate_y, b_sdate_m, b_sdate_d, b_edate_y, b_edate_m, b_edate_d, b_zip1, b_zip2, b_addr1, b_addr2
	Dim b_sdate_h, b_sdate_n

	
	Set UploadForm = Server.CreateObject("DEXT.FileUpload")
	UploadForm.DefaultPath = server.MapPath("/")&"\data\"



	R_Fields = "b_num, b_type, b_id, b_name, b_pwd, b_subject, b_email, b_jumin, b_phone1, b_phone2, b_phone3, b_noticechk, b_ip, b_count, b_look, b_open, b_ref, b_step, b_level, b_regdate, b_chuchun, b_sbjclr, b_temp1, b_temp2, b_temp3, b_temp4,b_temp5, b_temp6, b_temp7, b_keyword, w_mode, b_cate_tot"

	R_Fields = R_Fields & ", b_sdate_y, b_sdate_m, b_sdate_d, b_edate_y, b_edate_m, b_edate_d, b_zip1, b_zip2, b_addr1, b_addr2"
	R_Fields = R_Fields & ", b_sdate_h, b_sdate_n"				'// 영화일정에 쓰이는 시간,분
	
	' 첨부파일
	If Not IsNumeric(a_upload_len) Then a_upload_len = 5
	For u=1 To a_upload_len
		R_Fields = R_Fields & ", b_file"&u			'' b_file1, b_file2, b_file3, ‥‥
	next


	Call RequestAll(R_Fields, "UploadForm")


	b_content		= InputValue2(UploadForm("b_content"))
	a_writecontent	= b_content
	b_sdate = b_sdate_y&"-"&Right(b_sdate_m,2)&"-"&Right("0"&b_sdate_d,2)
	b_edate = b_edate_y&"-"&Right(b_edate_m,2)&"-"&Right("0"&b_edate_d,2)


'	If a_close="Y" And b_noticechk<>"Y" then	' 전체 비밀글
'		b_open="N"
'	End if



	chk_str = ""
	'//입력값 체크

	chk_str = chk_str &  valueChk(b_name, "이름", "b_name")
	If is_ad_cms <> "Y" Then chk_str = chk_str &  valueChk(b_pwd, "비밀번호", "b_pwd")

	If a_cate = "Y" and b_type <> "R" then	'//분류
		chk_str = chk_str &  valueChk(b_cate_tot, "분류", "b_cate_tot")
	End if

	chk_str = chk_str &  valueChk(b_subject, "제목", "b_subject")
	chk_str = chk_str &  valueChk(b_content, "내용", "b_content")


	'//입력값 체크 끝

	If chk_str <> "" Then
		If is_ad_cms <> "Y" Then
			readonly = "readonly='readonly'"
		End If
		
		b_file1 = ""
		b_file2 = ""
		b_file3 = ""
		b_file4 = ""
		b_file5 = ""

		'//관리자일때 비번을 입력하지 않는다..
'		b_name		= SESSION("ss_m_name")
		b_pwd		= SESSION("ss_m_pwd")
		b_jumin		= ""


		If a_level = "nninc_simple" Then
		%><!--#include virtual="/content/board/nninc_simple/inc_write.asp"--><%
		ElseIf a_level = "default_photo" Then
		%><!--#include virtual="/content/board/default_photo/inc_write.asp"--><%
		ElseIf a_level = "default_calendar" Then
		%><!--#include virtual="/content/board/default_calendar/inc_write.asp"--><%
		ElseIf a_level = "nninc_qna" Then
		%><!--#include virtual="/content/board/nninc_qna/inc_write.asp"--><%
		ElseIf a_level = "nninc_faq" Then
		%><!--#include virtual="/content/board/nninc_faq/inc_write.asp"--><%	
		End if

	Else
	
		b_jumin		= SESSION("ss_m_jumin")

		if a_level = "nninc_file" Then
			%><!--include virtual="/content/board/nninc_file/write_ok.asp"--><%
		Else
			
			%><!--#include virtual="/content/board/inc_write_ok.asp"--><%
		End if
	End if

End if


function valueChk( value, val_name, is_label)
	Dim rtn_value
	rtn_value = ""
	If trim( value ) = "" then
		rtn_value = "<li><label for='" & is_label& "'><strong class='error'>" & val_name & "</strong>을(를) 입력하세요.</label></li>" & vbcrlf

	End If
	valueChk = rtn_value
End Function

function msgChk( msg )
	rtn_value = "<li><label for='" & is_label& "'>"&msg&"</li>" & vbcrlf

	msgChk = rtn_value
End function
%>