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

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

<%

' 파라미터정보 *************************************************************************************
eb_idx		= InputValue(request("eb_idx"))
status		= InputValue(request("status"))
' **************************************************************************************************


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

	chk = Replace( request("chk"), " ", "")
	arr_chk = Split(chk,",")

	For z=0 To UBound(arr_chk)

		sql = "select eb_pk, eb_logoimg from ebook where eb_idx= "&arr_chk(z)
		Set Rs = Dbcon.Execute (sql)
		If Not rs.eof Then
			eb_pk = rs("eb_pk")
			eb_logoimg = rs("eb_logoimg")
		End If
		rs.close : Set rs = nothing		
	
		' ebook 삭제
		sql = " delete from ebook where eb_pk = "&eb_pk
		Dbcon.execute sql


		' 페이지 삭제
		sql = " delete from ebook_page where eb_pk = "&eb_pk
		Dbcon.execute sql




		Call dfolder (server.mappath("/")&"\data\ebook\"&eb_pk&"\middle")
		Call dfolder (server.mappath("/")&"\data\ebook\"&eb_pk&"\small")
		Call dfolder (server.mappath("/")&"\data\ebook\"&eb_pk)

''''''''''''''''''''''''''''

		' 폴더삭제
'		exec("rm -rf ".$_SERVER[DOCUMENT_ROOT]."/data/ebook/".$eb_pk);

		
		strDir		= server.mappath("/")&"\data\ebook\logo\"

		If eb_logoimg <> "" then
			Call dfile(strDir, eb_logoimg)
		End if


	next

Else ' 일반삭제


	sql = "select eb_pk, eb_logoimg from ebook where eb_idx= "&eb_idx
	Set Rs = Dbcon.Execute (sql)

	eb_pk		= rs("eb_pk")
	eb_logoimg  = rs("eb_logoimg")

	rs.close : Set rs = nothing


	' ebook 삭제
	sql = " delete from ebook where eb_pk = "&eb_pk
	Dbcon.execute sql


	' 페이지 삭제
	sql = " delete from ebook_page where eb_pk = "&eb_pk
	Dbcon.execute sql

	' 폴더삭제
	Call dfolder (server.mappath("/")&"\data\ebook\"&eb_pk&"\middle")
	Call dfolder (server.mappath("/")&"\data\ebook\"&eb_pk&"\small")
	Call dfolder (server.mappath("/")&"\data\ebook\"&eb_pk)
	
	strDir		= server.mappath("/")&"\data\ebook\logo\"

	If eb_logoimg <> "" then
		Call dfile(strDir, eb_logoimg)
	End If


End If

Dbcon.close : Set Dbcon = Nothing

ok_url = "list.asp?"&page_info

Call loding ("0", ok_url)


%>