최초등록
This commit is contained in:
@@ -0,0 +1,152 @@
|
||||
<!--#include virtual="/common/lib/dbcon.asp"-->
|
||||
<!--#include virtual="/common/lib/func.asp"-->
|
||||
<!--#include file="config.asp"-->
|
||||
<%
|
||||
|
||||
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
|
||||
Dim a_num, chk, m_tablename
|
||||
a_num = InputValue(request("a_num"))
|
||||
chk = InputValue(request("chk"))
|
||||
m_tablename = InputValue(request("m_tablename"))
|
||||
|
||||
chk = Replace(chk, " ","")
|
||||
arr_chk = Split(chk,",")
|
||||
|
||||
|
||||
sql = " SELECT a_bbsname, a_num FROM board_config with(nolock) WHERE a_tablename='"&m_tablename&"'"
|
||||
Set Rs = Dbcon.Execute (sql)
|
||||
If Not rs.eof Then
|
||||
m_bbsname = rs(0)
|
||||
m_a_num = rs(1)
|
||||
End If
|
||||
rs.close : Set rs = Nothing
|
||||
m_content = "해당 게시글은 관리자에 의해 [[board_link_s]]"&m_a_num&"[[board_link_m]]["&m_bbsname&"][[board_link_e]] 으로 이동되었습니다.[[br_tag]]("&getDateFm(now,3)&")"
|
||||
|
||||
|
||||
|
||||
filePath = server.mappath("/")&"\data\board\"
|
||||
|
||||
'//폴더 없으면 새로 생성
|
||||
Call FolderCreate( filePath & m_tablename& "\" )
|
||||
|
||||
|
||||
|
||||
If is_ad_cms <> "Y" or a_num="" Or Replace(chk,",","")="" Or m_tablename="" then
|
||||
|
||||
Call goMessage_board("정보가 정확하지 않거나 접속권한이 없습니다.","/content/board/list.asp?a_num="&a_num, "", "", a_num)
|
||||
|
||||
else
|
||||
|
||||
'' 기존 게시판 테이블명 가져오기
|
||||
sql = " SELECT a_tablename FROM board_config with(nolock) WHERE a_num="& a_num
|
||||
Set Rs = Dbcon.Execute (sql)
|
||||
If rs.eof Then
|
||||
Call goMessage_board("정보가 정확하지 않습니다.", "/content/board/list.asp?a_num="&a_num, "", "", a_num)
|
||||
Else
|
||||
o_tablename = rs(0)
|
||||
End If
|
||||
rs.close : Set rs = Nothing
|
||||
|
||||
|
||||
|
||||
'' 선택된 게시물 이동
|
||||
For i=UBound(arr_chk) To 0 Step -1
|
||||
|
||||
|
||||
b_num = arr_chk(i)
|
||||
|
||||
|
||||
|
||||
'' 게시글 옮기기
|
||||
sql = " INSERT INTO "& m_tablename &" ( b_type, b_id, b_name, b_pwd, b_subject, b_email, b_jumin, b_phone1, b_phone2, b_phone3, b_cate, b_catename, b_noticechk, b_content, b_ip, b_count, b_look, b_open, b_step, b_level, b_regdate, b_chuchun, b_sbjclr, b_sdate, b_edate, b_temp1, b_temp2, b_temp3, b_temp4, b_temp5, b_temp6, b_temp7, b_temp8, b_file1, b_file2, b_file3, b_file4, b_file5, b_keyword, b_c_count, b_zip1, b_zip2, b_addr1, b_addr2 ) SELECT b_type, b_id, b_name, b_pwd, b_subject, b_email, b_jumin, b_phone1, b_phone2, b_phone3, b_cate, b_catename, b_noticechk, b_content, b_ip, b_count, b_look, b_open, b_step, b_level, b_regdate, b_chuchun, b_sbjclr, b_sdate, b_edate, b_temp1, b_temp2, b_temp3, b_temp4, b_temp5, b_temp6, b_temp7, b_temp8, b_file1, b_file2, b_file3, b_file4, b_file5, b_keyword, b_c_count, b_zip1, b_zip2, b_addr1, b_addr2 FROM "& o_tablename & " WHERE b_num="&b_num
|
||||
Dbcon.execute sql
|
||||
|
||||
|
||||
'' b_num 얻기
|
||||
sql = " select isnull(max(b_num),0) from "&m_tablename
|
||||
Set Rs = Dbcon.Execute (sql)
|
||||
new_b_num = rs(0)
|
||||
rs.close : Set rs = Nothing
|
||||
|
||||
|
||||
'' ref 업데이트
|
||||
sql = " UPDATE " & m_tablename & " SET b_ref="&new_b_num&" WHERE b_num="&new_b_num
|
||||
Dbcon.execute sql
|
||||
|
||||
|
||||
|
||||
'' 파일 이동
|
||||
sql = " SELECT b_file1, b_file2, b_file3, b_file4, b_file5 FROM "&o_tablename&" WHERE b_num="&b_num
|
||||
Set Rs = Dbcon.Execute (sql)
|
||||
If Not rs.eof Then
|
||||
|
||||
For j=1 To 5
|
||||
fileName = rs("b_file"&j)
|
||||
|
||||
If fileName<>"" Then
|
||||
|
||||
'--확장장와 파일 이름 분리
|
||||
strfile = split(fileName,".")
|
||||
strName = strfile(0) '파일명
|
||||
strExt = strfile(UBound(strfile)) '확장자
|
||||
|
||||
|
||||
file_url = filePath & o_tablename & "\" & fileName
|
||||
saveFileName = filePath & m_tablename & "\" & fileName
|
||||
|
||||
|
||||
' 첨부파일 존재하면
|
||||
If (FSO.FileExists(file_url)) Then
|
||||
bExist = True
|
||||
count= 0
|
||||
Do While bExist
|
||||
|
||||
' 파일명 중복검사
|
||||
If (FSO.FileExists(saveFileName)) Then
|
||||
count = count + 1
|
||||
FileName = strName & "_" & count & "." & strExt
|
||||
saveFileName = filePath & m_tablename & "\" & FileName
|
||||
Else
|
||||
|
||||
Exit Do
|
||||
|
||||
End If
|
||||
Loop
|
||||
|
||||
FSO.MoveFile file_url,saveFileName
|
||||
|
||||
|
||||
' 파일명 update
|
||||
sql = " UPDATE " & m_tablename & " SET b_file"&j&"='"&FileName&"' WHERE b_num="&new_b_num
|
||||
Dbcon.execute sql
|
||||
|
||||
|
||||
End if
|
||||
End If
|
||||
|
||||
Next
|
||||
End if
|
||||
rs.close : Set rs = Nothing
|
||||
|
||||
|
||||
'기존 게시물 삭제
|
||||
' sql = " DELETE FROM "&o_tablename & " WHERE b_num="&b_num
|
||||
|
||||
sql = " UPDATE "&o_tablename&" SET b_content='"&m_content&"', b_file1='', b_file2='', b_file3='', b_file4='', b_file5='' WHERE b_num="&b_num
|
||||
Dbcon.execute sql
|
||||
|
||||
|
||||
next
|
||||
|
||||
End if
|
||||
|
||||
Dbcon.close : Set Dbcon = Nothing
|
||||
|
||||
|
||||
ok_url = "list.asp?a_num=" & a_num
|
||||
Call goMessage_board("이동되었습니다..", ok_url, "", "", a_num)
|
||||
|
||||
|
||||
%>
|
||||
Reference in New Issue
Block a user