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

Dim R_Fields, R_Fields_i
Dim a_num, b_num, c_pwd, c_name, cm_mode, c_num

R_Fields = "a_num, b_num, c_pwd, c_name, cm_mode, c_num"
Call RequestAll(R_Fields, "request")



	If cm_mode = "W" then		'//저장처리
		
		c_bnum			= b_num
		c_id			= SESSION("ss_m_id")
		c_content		= InputValue2(request.Form("c_content"))
		c_regdate		= getdatefm(Now(), 3)
		


		R_Fields_i = "a_num, c_bnum, c_id, c_pwd, c_name, c_content, c_regdate"
		Call InsertQuery (R_Fields_i, "board_command")

		'//댓글수 추가
		sql = "UPDATE " & a_tablename & " Set b_c_count = b_c_count + 1 Where b_num = " & b_num
		dbcon.execute sql


	

	ElseIf cm_mode = "D" then		'// 삭제 처리
		

		sql	= "select c_pwd from board_command where c_num = " & c_num
		Set rs_cd = dbcon.execute( sql )

		is_c_pwd = rs_cd("c_pwd")		'//삭제할 글의 비번..


		'//if ($c_pwd == $is_c_pwd || $is_ad_cms == "Y") { //비번이 일치하면
		if c_pwd = is_c_pwd then		'//비번이 일치하면

			SQL = "Delete From board_command where c_num = " & c_num
			dbcon.execute sql

			'//댓글수 삭제
			sql = "UPDATE " & a_tablename & " Set b_c_count = b_c_count - 1 Where b_num = " & b_num
			dbcon.execute sql

		else

			Call goMessage_board("비밀번호가 일치하지 않습니다.", Request.ServerVariables("HTTP_REFERER"),"", "", a_num)
		End if
	End if

ok_url = "view.asp?a_num=" & a_num & "&amp;b_num=" & b_num & "&amp;" & page_info

'//echo "<br>ok_url===".$ok_url;
'//exit;

Call loding ("0", ok_url)
%>
