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

eb_pk		= InputValue(request("eb_pk"))
is_size		= InputValue(request("is_size"))

If is_size <> "" then

	SESSION("is_size") = is_size
End if









If eb_pk = "" then

	sql = "select top 1 eb_pk from ebook ORDER BY eb_code ASC "
	Set Rs = Dbcon.Execute (sql)
	If Not rs.eof Then
		eb_pk = rs("eb_pk")
		rs.close : Set rs = nothing
	Else
		rs.close : Set rs = nothing
		Call Back_back("등록된 데이터가 없습니다.")
	End If
ElseIf Not( IsNumeric(eb_pk) ) then

		Call goMessage_board("잘못된 접속입니다.(101)", "/", "", "" , a_num)
		response.end
End if



' 레코드필드
R_Fields		= "eb_idx, eb_subject, eb_skin, eb_logoimg, eb_wdate, eb_mdate, eb_chk, eb_viewtype"
R_tablename_str	= "ebook "
R_WHERE_str		= " WHERE eb_pk= '"&eb_pk & "'"

Call SelectQuery (R_Fields, R_tablename_str, R_WHERE_str)



' 테이블 기본 환경설정 ********************************************************************************
table			= "ebook_page"		' 테이블명
idx_field		= "ebp_idx"			' 기본키
oreder_filed	= "ebp_code ASC"	' 정렬기준 필드
Query_Fields	= "ebp_idx, ebp_subject, ebp_code, ebp_pageimg, ebp_wdate, ebp_mdate, ebp_chk, eb_pk"	' 불러올 필드
' ****************************************************************************************************
Query_OrderBy = " ORDER BY "&oreder_filed
' ---------------------------------------------------------------










' ---------------조합 쿼리문------------------------------------
v_keyword	= InputValue(request("p_keyword"))
If v_keyword <> "" then
	search_str = " AND  ebp_subject like '%"&v_keyword&"%'"
End if

' -----------------------------리스트 출력 쿼리문 생성-----------------------------
sql = "select "&Query_Fields&" from "&table&" WHERE eb_pk = "&eb_pk&""
sql = sql & search_str & search_str2 & Query_OrderBy
Set Rs = Dbcon.Execute (sql)
If Not rs.eof Then
	vData = rs.getrows()
	vCnt = UBound(vData,2)
Else
	vCnt = -1
End If
rs.close : Set rs = nothing

' ---------------------------------------------------------------------------------



If vCnt>-1 Then
	zz = 1
	
	flippingBook_pages = ""

	flippingBook_contents = ""

	For i=0 To vCnt

		' 필드갯수만큼 ($Query_Fields).가지고온다..
		Call arr2Value(Query_Fields, "vData", i)


		If zz <> 1 Then	flippingBook_pages = flippingBook_pages&", "

		If ebp_pageimg = "" then

			flippingBook_pages = flippingBook_pages & "''"

		else
			
			flippingBook_pages = flippingBook_pages & "'/data/ebook/"&eb_pk&"/"&ebp_pageimg&"' "

		End if


		If zz <> 1 Then	flippingBook_contents = flippingBook_contents&", "
		flippingBook_contents = flippingBook_contents & " [ '"&ebp_subject&"', "&zz&" ]  "

		zz = zz + 1
	next


End if


If trim(eb_skin)="1" Then
%><!--#include virtual="/content/ebook/skin1/index.asp"--><%
ElseIf trim(eb_skin)="2" Then
%><!--#include virtual="/content/ebook/skin2/index.asp"--><%
ElseIf trim(eb_skin)="3" Then
%><!--#include virtual="/content/ebook/skin3/index.asp"--><%
ElseIf trim(eb_skin)="4" Then
%><!--#include virtual="/content/ebook/skin4/index.asp"--><%
ElseIf trim(eb_skin)="5" Then
%><!--#include virtual="/content/ebook/skin5/index.asp"--><%
ElseIf trim(eb_skin)="6" Then
%><!--#include virtual="/content/ebook/skin6/index.asp"--><%
End if

%>
