 ''***************************************
 ''* 문의사항은 
 ''* 만든이 : 옥창윤
 ''* 홈페이지 : http://www.inote.pe.kr 
 ''* 이메일 : changyunok@dreamwiz.com
 ''***************************************
 
 
 데모 홈페이지
 http://www.inote.pe.kr/www/
 
 관리자 페이지
 http://www.inote.pe.kr/aspboard/admin
 아이디 : admin
 패스워드 : admin
 
 폴더설명
 aspboard(변경가능 lib/config.asp) ==> 게시판,회원 폴더

 admin	==> 관리자모드 폴더
 lib	==> config.asp(디비및 경로설정) function.asp 함수모음
 skin	==> 게시판 스킨폴더
 upload_file	==> 자료실폴더(쓰기권한이 있어야 합니다.)

 파일설명
 popup_include.asp	==> 팝업창사용시 사용
 예) index.asp 페이지인경우
 페이지 제일 상단
 <!-- #include file = "aspboard/lib/config.asp" -->
 <!-- #include file = "aspboard/popup_include.asp" -->

 global.asa_ ==> 사용시 홈 루트에 위치
 (global.asa_ ==> global.asa 로 변경해야함 , 디비 정보 설정)


 
 
 설치순서
 1. lib 폴더안에 config.asp 파일을 열고 환경설정을한다
 	 Db_Odbc_Name = "test"	--> 디비명
	 Db_Odbc_User = "test"  --> 디비아이디
	 Db_Odbc_Pass = "test"  --> 디비패스워드
	 sql_ip = "localhost"	--> 디비서버 주소 
	 
	 ''/// 로컬경로
	 PathDir		= "D:\inote\aspboard\"   -> 마지막에 \ 에 주의하세요
	 ''/// 상대경로
	 PathHttp		= "http://www.inote.pe.kr/aspboard/"  --> http://자기도메인/게시판폴더/  마지막에 / 에 주의하세요
	 
 2. 아래 테이블 생성
 
 3. upload_file  --> 요폴더에 쓰기 권한설정
 
 4. post2000.xls 우편번호생성(회원가입을 사용하지않는다면 필요없습니다.)
 
 5. 설치후 관리자 모드 접속 http://설치된 도메인/설치폴더/admin/ 예) http://www.inote.pe.kr/aspboard/admin
 

 
 ''*************************************************
 ''* 특징
 ''*************************************************
 asp 스킨게시판 구현하는거 모르시는분들은 도움이 되리라 생각됩니다.
 (소스가 복잡하고 어렵지 않습니다.)
 
 
 ''*************************************************
 ''* 기능
 ''*************************************************
	데모사이트 보삼
	
 ''*************************************************
 ''* 라이센스
 ''*************************************************
	없삼~~~ 자유로이 사용하세요
	
	
	
// 테이블 생성 및 프로시져 생성 

-- 여기부터 복사 --
CREATE TABLE [dbo].[BOARD_ADMIN] (
	[ADMIN_ID] [varchar] (30) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[ADMIN_PWD] [varchar] (30) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[ADMIN_NAME] [varchar] (30) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[ADMIN_EMAIL] [varchar] (100) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[ADMIN_LOGIN_COUNT] [int] NULL ,
	[ADMIN_LAST_LOGIN] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[BOARD_CATEGORY] (
	[B_CODE] [varchar] (20) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[CATEGORY_NO] [int] NOT NULL ,
	[CATEGORY_NAME] [varchar] (50) COLLATE Korean_Wansung_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[BOARD_COMMENT] (
	[C_IDX] [int] IDENTITY (1, 1) NOT NULL ,
	[C_ID] [varchar] (20) COLLATE Korean_Wansung_CI_AS NULL ,
	[B_CODE] [varchar] (30) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[IDX] [int] NOT NULL ,
	[C_NAME] [varchar] (20) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[C_PWD] [varchar] (20) COLLATE Korean_Wansung_CI_AS NULL ,
	[C_WRITEDAY] [datetime] NOT NULL ,
	[C_MEMO] [text] COLLATE Korean_Wansung_CI_AS NOT NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[BOARD_CONFIG] (
	[IDX] [int] IDENTITY (1, 1) NOT NULL ,
	[B_CODE] [varchar] (30) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[B_BOARDNAME] [varchar] (30) COLLATE Korean_Wansung_CI_AS NULL ,
	[B_SKIN] [varchar] (30) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[B_H_FILE] [varchar] (150) COLLATE Korean_Wansung_CI_AS NULL ,
	[B_H_HTML] [text] COLLATE Korean_Wansung_CI_AS NULL ,
	[B_F_FILE] [varchar] (150) COLLATE Korean_Wansung_CI_AS NULL ,
	[B_F_HTML] [text] COLLATE Korean_Wansung_CI_AS NULL ,
	[B_SUBJECT_CUT] [int] NULL ,
	[B_LIST_SIZE] [int] NOT NULL ,
	[B_WIDTH] [int] NOT NULL ,
	[B_COMMENT_U] [char] (1) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[B_PDS_U] [char] (1) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[B_PDS_CNT] [int] NOT NULL ,
	[B_MAX_UPLOAD_SIZE] [int] NOT NULL ,
	[B_SECURITY_CONFIG_U] [char] (1) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[B_CATEGORY_U] [char] (1) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[B_VIEW_LIST_U] [char] (1) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[B_ACCESS_WRITE] [varchar] (50) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[B_ACCESS_LIST] [varchar] (50) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[B_ACCESS_DOWN] [varchar] (50) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[B_ACCESS_VIEW] [varchar] (50) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[B_ACCESS_REPLE] [varchar] (50) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[B_WRITEDAY] [datetime] NOT NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO


CREATE TABLE [dbo].[LOG_TABLE] (
	[vNum] [int] IDENTITY (1, 1) NOT NULL ,
	[vIP] [varchar] (15) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[vYY] [smallint] NOT NULL ,
	[vMM] [tinyint] NOT NULL ,
	[vDD] [tinyint] NOT NULL ,
	[vHH] [tinyint] NOT NULL ,
	[vMT] [tinyint] NOT NULL ,
	[vSeason] [tinyint] NOT NULL ,
	[vDW] [tinyint] NOT NULL ,
	[vBrowser] [varchar] (50) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[vOS] [varchar] (50) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[vReferer] [varchar] (200) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[vTarget] [varchar] (200) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[writeday] [smalldatetime] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[MEMBER_TABLE] (
	[IDX] [int] IDENTITY (1, 1) NOT NULL ,
	[M_ID] [varchar] (30) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[M_PWD] [varchar] (30) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[M_NAME] [varchar] (30) COLLATE Korean_Wansung_CI_AS NOT NULL ,
	[M_EMAIL] [varchar] (100) COLLATE Korean_Wansung_CI_AS NULL ,
	[M_SSH] [varchar] (14) COLLATE Korean_Wansung_CI_AS NULL ,
	[M_TEL] [varchar] (20) COLLATE Korean_Wansung_CI_AS NULL ,
	[M_HP] [varchar] (20) COLLATE Korean_Wansung_CI_AS NULL ,
	[M_ZIP] [varchar] (7) COLLATE Korean_Wansung_CI_AS NULL ,
	[M_ADDRESS1] [varchar] (100) COLLATE Korean_Wansung_CI_AS NULL ,
	[M_ADDRESS2] [varchar] (100) COLLATE Korean_Wansung_CI_AS NULL ,
	[M_LOGIN_COUNT] [int] NOT NULL ,
	[M_WRITEDAY] [datetime] NOT NULL ,
	[M_LAST_LOGIN] [datetime] NOT NULL ,
	[M_LEVEL] [tinyint] NOT NULL ,
	[M_MAILING_U] [char] (1) COLLATE Korean_Wansung_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[POPUP_TABLE] (
	[IDX] [int] IDENTITY (1, 1) NOT NULL ,
	[P_SUBJECT] [varchar] (255) COLLATE Korean_Wansung_CI_AS NULL ,
	[P_CONTENT] [text] COLLATE Korean_Wansung_CI_AS NULL ,
	[P_POPUP_U] [char] (1) COLLATE Korean_Wansung_CI_AS NULL ,
	[P_WRITEDAY] [smalldatetime] NULL ,
	[P_STARTDAY] [varchar] (10) COLLATE Korean_Wansung_CI_AS NULL ,
	[P_ENDDAY] [varchar] (10) COLLATE Korean_Wansung_CI_AS NULL ,
	[P_WIN_WIDTH] [int] NULL ,
	[P_WIN_HEIGHT] [int] NULL ,
	[P_WIN_LEFT] [int] NULL ,
	[P_WIN_TOP] [int] NULL ,
	[P_MOVEURL] [varchar] (200) COLLATE Korean_Wansung_CI_AS NULL ,
	[P_FILE] [varchar] (50) COLLATE Korean_Wansung_CI_AS NULL ,
	[P_STYLE] [char] (1) COLLATE Korean_Wansung_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO




ALTER TABLE [dbo].[BOARD_COMMENT] WITH NOCHECK ADD 
	CONSTRAINT [PK_BOARD_COMMENT] PRIMARY KEY  CLUSTERED 
	(
		[C_IDX]
	) WITH  FILLFACTOR = 90  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[BOARD_CONFIG] WITH NOCHECK ADD 
	CONSTRAINT [PK_BOARD_CONFIG] PRIMARY KEY  CLUSTERED 
	(
		[B_CODE]
	) WITH  FILLFACTOR = 90  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[MEMBER_TABLE] WITH NOCHECK ADD 
	CONSTRAINT [PK_MEMBER_TABLE] PRIMARY KEY  CLUSTERED 
	(
		[M_ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[POPUP_TABLE] WITH NOCHECK ADD 
	CONSTRAINT [PK_POPUP_TABLE] PRIMARY KEY  CLUSTERED 
	(
		[IDX]
	) WITH  FILLFACTOR = 90  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[LOG_TABLE] ADD 
	CONSTRAINT [DF_LOG_TABLE_writeday] DEFAULT (getdate()) FOR [writeday]
GO

ALTER TABLE [dbo].[POPUP_TABLE] ADD 
	CONSTRAINT [DF_POPUP_TABLE_PopupYN] DEFAULT (0) FOR [P_POPUP_U]
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS OFF 
GO

CREATE PROCEDURE [dbo].[BOARD_LIST]
@B_LIST_SIZE		varchar(30),
@B_CODE			varchar(30),
@gotopage			varchar(30),
@where_qry		 	varchar(100)
as
declare
@sqlquery		varchar(1000)
	
set @sqlquery  = 'set transaction isolation level read uncommitted select top ' + @B_LIST_SIZE + ' * from '+ @B_CODE +'  where B_NOTICE_U= ''N''  '+@where_qry+' and  IDX not in (select top '+ str(((@gotopage - 1) * @B_LIST_SIZE)) +' IDX from '+@B_CODE+'  where B_NOTICE_U = ''N''  '+@where_qry+'  order by B_REF desc,B_STEP asc) order by B_REF desc,B_STEP asc '
exec(@sqlquery)
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS OFF 
GO

CREATE PROCEDURE [dbo].[BOARD_LIST_COUNT]
@B_CODE			varchar(30),
@where_qry			varchar(100)
as
declare
@sqlquery		varchar(1000)
	
set @sqlquery  = 'set transaction isolation level read uncommitted Select count(IDX) from '+@B_CODE+' where  B_NOTICE_U = ''N''   ' +@where_qry+''
exec(@sqlquery)
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

CREATE PROCEDURE [dbo].[BOARD_NOTICE]
@B_CODE			varchar(30)
as
declare
@sqlquery		varchar(1000)
	
set @sqlquery  = ' set transaction isolation level read uncommitted Select * From '+@B_CODE+' where 1=1 and B_NOTICE_U = ''Y'' order by IDX desc'
exec(@sqlquery)
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

INSERT INTO BOARD_ADMIN VALUES('admin','admin','관리자','test@test.com',0,getdate())
INSERT INTO LOG_TABLE VALUES('111.111.111.111','2006','5','22','11','6','1','2','MSIE 6.0','Windows NT 5.1','http://www.inote.pe.kr/Zmall/Zadmin/log/log_list.asp','/Zmall/Zmall_default.asp?',GETDATE())


-- 여기까지 복사 해서 쿼리분석기로 생성하세요--