%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
RESPONSE.AddHeader "Pragma","no-cache"
RESPONSE.AddHeader "Cache-Control","private"
RESPONSE.CacheControl = "no-chche"
RESPONSE.Buffer = True
RESPONSE.Expires = -1
Response.Codepage = "65001"
Response.CharSet = "utf-8"
%>
<%
Dim DB
Dim strConnection
Set DB = Server.CreateObject("ADODB.Connection")
strConnection = "Provider=SQLOLEDB;Data Source =134.75.217.82;Initial Catalog =SM_nsmile;User id=sm_smile; Password=jo1741*;"
DB.Open strConnection
%>
<%
Function EditConvertChar(strValue)
strValue = Replace(strValue, """", """)
EditConvertChar=strValue
End Function
Function ConvertChar(strValue)
strValue = Replace(strValue, "&", "&")
strValue = Replace(strValue, """", """)
strValue = Replace(strValue, "|", "|")
strValue = Replace(strValue, "<", "<")
strValue = Replace(strValue, ">", ">")
strValue = Replace(strValue, chr(32), " ")
ConvertChar=strValue
End Function
Function ReverseWord(strValue)
'strValue = Replace(strValue,Chr(13), ">>")
strValue = Replace(strValue, "&", "&")
strValue = Replace(strValue, """, """")
strValue = Replace(strValue, "|", "|")
'strValue = Replace(strValue, "<", "<")
'strValue = Replace(strValue, ">", ">")
strValue = Replace(strValue, " ", chr(32))
ReverseWord = strValue
End Function
Function TrimCheck(strValue)
IF Trim(strValue) = "" THEN
Response.Redirect "/error/Error.asp?err_msg="&Server.URLEncode("내용이 입력되어 있지 않습니다.")
END IF
TrimCheck = strValue
End Function
Function Sel_gubun(code,gubun)
If code="fnotice" then
if gubun="A" then
gubun_name = "학사"
elseif gubun="B" then
gubun_name = "장학"
elseif gubun="C" then
gubun_name = "취업"
elseif gubun="D" then
gubun_name = "기타"
end If
End If
Sel_gubun = gubun_name
End Function
' 이미지 실제크기 알아내기
Function GetImageSize(Virtual_Image_Path)
Dim objPic
Set objPic = LoadPicture(Virtual_Image_Path)
imgWidth = CLng(CDbl(objPic.Width) * 24 / 635)
imgHeight = CLng(CDbl(objPic.Height) * 24 / 635)
Set objPic = Nothing
GetImageSize=imgWidth&","&imgHeight
End Function
' 이미지 비율에 따라 축소하기
Function SetImageSize(img,widsize)
image = GetImageSize(img)
image = split(image, ",")
iwidth = image(0)
iheight = image(1)
'response.write iwidth
'response.write iheight
'response.end
width = widsize
'response.write width
'가로가 세로보다 클경우
if (Cint(iwidth) > Cint(iheight)) then
if(Cint(iwidth) > Cint(width)) then
iheight = iheight * width / iwidth
iwidth = width
end if
'세로가 가로보다 클경우
elseif (Cint(iwidth) < Cint(iheight)) then
if (Cint(iheight) > Cint(width)) then
iwidth = iwidth * width / iheight
iheight = width
end if
'가로,세로 같을경우
else
if (Cint(iwidth) > Cint(width)) then
iwidth = width
iheight = width
end if
end if
SetImageSize = iwidth&","&iheight
End Function
'제목글길이에 맞게 제목글 출력하기
function title_str(str,su)
dim tmp
str = Replace(str, " ", " ")
str_true_length = Len(str)
'response.write str_true_length&":"
tmp = Left(str,su)
str_length = Len(tmp)
'response.write su
if Cint(str_true_length) >= Cint(su) then '원래의 글자길이가 원하는 글자길이보다 길다면
if str_length mod 2 = 0 then
title_str = tmp & "..."
else
tmp = Left(str,su-1)
title_str = tmp & "..."
end if
else
title_str = tmp
end if
end function
' 이미지경로 추출
Function ImgTag(contents)
Set regEx = New RegExp ' 정규식을 작성합니다.
regEx.IgnoreCase = True ' 대/소문자 구분 안함을 설정합니다.
regEx.Global = True ' 전역을 설정합니다.
contents = replace(contents,"""","")
regEx.Pattern = "[^=']*\.(gif|jpg|bmp|png)"
Set Matches = regEx.Execute(contents) ' 찾기를 실행합니다.
'RetStr = ""
For Each Match in Matches ' Matches 컬렉션을 반복합니다.
'RetStr = RetStr & " " & Match.Value & vbcrlf
ImgStr = Matches(0)
Next
ImgTag = ImgStr
End Function
' 내용에 태그 제거
Function strip_Tag(contents)
Set regEx = New RegExp ' 정규식을 작성합니다.
regEx.IgnoreCase = True ' 대/소문자 구분 안함을 설정합니다.
regEx.Global = True ' 전역을 설정합니다.
contents = replace(contents,"""","")
regEx.Pattern = "<[^>]*>"
strReturn = regEx.replace(contents,"") ' 찾기를 실행합니다.
strip_Tag = strReturn
End Function
%>
선문대학교 시설예약시스템
<%
' 답변값을 위해서 리스트에서 먼저 받아옴
search = trim(request("search"))
searchstring = replace(request("searchstring"),"'","''")
searchstring = trim(searchstring)
page = request("page")
code = request("code")
gubun = request("gubun")
bbs_no = request("bbs_no")
bbs_ref = request("bbs_ref")
bbs_step = request("bbs_step")
bbs_level = request("bbs_level")
'if code="data" Or code="app" Or code="report" Or code="paper" Then
' if session("m_level")<>"1" and session("u_id")="" then
' response.write ""
' response.end
' end if
'End If
SQL = "Select * from tb_bbs where bbs_no="&bbs_no
Set rs = db.Execute(SQL)
bbs_open = rs("bbs_open")
'bbs_content = replace(rs("bbs_content"),chr(13)&chr(10)," ")
bbs_content = rs("bbs_content")
' 비공개 게시물일경우
if session("m_level")<>"1" then ' 관리자가 아니라면
opSQL = "Select bbs_id from tb_bbs where bbs_no="&bbs_ref&" order by bbs_no asc"
'response.write opSQL
Set oprs = db.Execute(opSQL)
if trim(bbs_open)="N" Then
If session("u_id")<>"" Then
If session("u_id")<>oprs("bbs_id") then
response.write ""
response.End
End If
Else
if session("chk_no")<>rs("bbs_ref") then
Response.Redirect "bbs_lock.asp?code="&code&"&bbs_no="&bbs_no&"&bbs_ref="&bbs_ref&"&bbs_step="&bbs_step&"&bbs_level="&bbs_level&"&page="&page&"&search="&search&"searchstring="&searchstring
end If
End if
end if
end If
%>
<%
If rs("code")="fnotice" And rs("bbs_gubun")<>"" Then
gubun_str = Sel_gubun(rs("code"),rs("bbs_gubun"))
response.write "["+gubun_str+"] "
End if
%>
<%=ReverseWord(rs("bbs_title"))%>
작 성 자 :
<%=rs("bbs_name")%><% if rs("bbs_email")<>"" then%>(<%=rs("bbs_email")%>)<%end if%>
<%
strDirectory = server.MapPath("\") & "\data\"
Set FSO = CreateObject("Scripting.FileSystemObject")
if code="photo" then
Dim bbs_file(5)
For i = 1 To 5
bbs_file(i) = rs("userfile"&i)
if bbs_file(i)<>"" Then
bbs_filename = split(bbs_file(i),".")
file_name = bbs_filename(0)
file_ext = bbs_filename(1)
strFile = strDirectory + rs("code")+"\"+rs("userfile"&i)
If (FSO.FileExists(strFile)) Then
if Lcase(file_ext)="jpg" or Lcase(file_ext)="gif" or Lcase(file_ext)="bmp" then
T_Size = GetImageSize(""+ strDirectory + rs("code")+"\"+rs("userfile"&i))
TSize = split(T_Size,",")
S_Size = SetImageSize(""+ strDirectory + rs("code")+"\"+rs("userfile"&i),"720")
SSize = split(S_Size,",")
%>
<%
end if
end if
end if
Next
end if
%>
<% if code="vod" and rs("userfile1")<>"" then %>
<% end if %>
<%=bbs_content%>
<% If rs("userfile1")<>"" Then %>
첨부파일 :
<%
For i = 1 To 5
strFile2 = strDirectory + rs("code")+"\"+ rs("userfile"&i)
'response.write strFile2
If (FSO.FileExists(strFile2)) Then
filename_encode = server.urlencode(rs("userfile"&i))
%>
["><%=rs("userfile"&i)%>]
<%
end if
Next
%>
<% End If %>
<%'==========답변=========%>
<% if session("m_id")<>"" or session("u_id")<>"" then %>
<% if rs("bbs_top")<>"Y" and (code="qna" or code="pqna") then %>
<% end if %>
<% end if %>
<%'==========수정=========%>
<% if session("u_id")=rs("bbs_id") or session("m_level")="1" then %>
<% end if %>
<%'==========삭제=========%>
<% if (session("u_id")<>"" And session("u_id")=rs("bbs_id")) or session("m_level")="1" then %>
<% ElseIf rs("bbs_id")="" Then %>
<% If code="talk" Or code="qna" Then %>
<% end if %>
<% end if %>
<%'==========목록=========%>
<% if code="app" Or code="report" Or code="paper" then %>
<%
' 코멘트 출력
CSQL = "Select * from tb_comment where code='"&code&"' and bbs_no="&bbs_no&" ORDER BY comment_no DESC"
Set crs = db.Execute(CSQL)
if not(crs.eof) then
%>
<%
end if
c = 1
Do while not Crs.EOF
comment_content = replace(crs("comment_content"),chr(13)&chr(10)," ")
comment_rest = c mod 2
if comment_rest="0" then
c_class = "comment"
else
c_class = "comment2"
end if
%>
<%
if session("m_level")="1" or session("u_id")<>"" then
if session("m_level")="1" then
comment_name = session("m_name")
else
comment_name = session("u_name")
end if
%>
<% end if %>
<% end if %>
<%
pSQL = "select * from tb_bbs where code='"&code&"' and bbs_top=''"
if gubun <> "" then
pSQL = pSQL&" and bbs_gubun='"&gubun&"'"
end if
if searchstring <> "" then
pSQL = pSQL&" and "&search&" like '%"&searchstring&"%'"
end if
pSQL = pSQL&" and bbs_no<"&bbs_no&" ORDER BY bbs_no DESC"
Set prs = Db.Execute(pSQL)
%>
<%
countQuery = " select count(comment_no) from tb_comment where code='"&code&"' and bbs_no="&bbs_no
Set ctrs = db.Execute(countQuery)
comment_writecnt = ctrs(0)
nSQL = "select * from tb_bbs where code='"&code&"' and bbs_top=''"
if gubun <> "" then
nSQL = nSQL&" and bbs_gubun='"&gubun&"'"
end if
if searchstring <> "" then
nSQL = nSQL&" and "&search&" like '%"&searchstring&"%'"
end if
nSQL = nSQL&" and bbs_no>"&bbs_no&" ORDER BY bbs_no asc"
Set nrs = Db.Execute(nSQL)
%>