<!--#include virtual = "/common/lib/dbcon.asp"-->
<!--#include virtual = "/common/lib/func.asp"-->
<%
Dim a_num, ct_idx, status, ct_ref
Dim sql, rs_3, strDir


'//------------------- 저장공간인 [DATA]폴더가 없다면 생성 한다. -------------------
FolderCreate( server.MapPath("/")&"\data\board_code\" )
'//------------------------------------------------------------------------------------

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


'//파라미터정보 *************************************************************************************
a_num		= InputValue(request("a_num"))
ct_idx		= InputValue(request("ct_idx"))
status		= InputValue(request("status"))
ct_ref		= InputValue(request("ct_ref"))

chk			= InputValue(request("chk"))
chk			= Replace( chk, " ", "" )
chk			= Split(chk, ",")
'//**************************************************************************************************

If status = "totdel" Then	'//다중삭제


	For z=0 To ubound(chk)

		sql = "Select ct_codeno,ct_file from board_code where ct_idx=" &chk(z)
		Set rs_3 = dbcon.execute( sql )

		ct_codeno	= rs_3("ct_codeno")
		ct_file		= rs_3("ct_file")


		'//이미지 삭제
		strDir		= server.mappath("/data/board_code/") & "\"

		If ct_file <> "" then
			Call dfile (strDir, ct_file)			'//삭제
		End if

		sql = " delete from board_code where ct_codeno like '%" & ct_codeno & "%'"
		dbcon.execute sql
	next



Else	'//일반삭제
	
	'//삭제하기

	sql = "Select ct_codeno, ct_file from board_code where ct_idx=" & ct_idx
	Set rs_3 = dbcon.execute( sql )

	ct_codeno	= rs_3("ct_codeno")
	ct_file		= rs_3("ct_file")


	'//이미지 삭제
	strDir		= server.mappath("/data/board_code/") & "\"

	If ct_file <> "" then
		Call dfile( strDir, ct_file)		'//삭제
	End if

	sql = " delete from board_code where ct_codeno like '%" & ct_codeno & "%'"
	'//echo $sql;
	dbcon.execute sql

End if


If ct_ref = "0" then ct_ref = ""
ok_url = "write.asp?a_num=" & a_num & "&amp;ct_idx=" & ct_ref

dbcon.close
Set dbcon = nothing

Call loding ("0", ok_url)

%>