쿠키(Cookies) 중복 체크 및 처리

ASP 2015. 11. 7. 16:30 Posted by Dayis

'-------------------------------------------------
' 쿠키 중복 체크
'-------------------------------------------------
Function CookieDuplicateCheck(tableName, idx)
    dim dupliChk
    dim c_read_idx
    dim i
    dupliChk = false
    
    c_read_idx = Request.Cookies("C_TABLE_NAME")("READ")
    
    Response.Cookies("C_TABLE_NAME") = tableName
    Response.Cookies("C_TABLE_NAME").Path = "/"
    Response.Cookies("C_TABLE_NAME").Expires = date+1

    arrRead = split(c_read_idx,",")
    for i = 1 to UBound(arrRead)
        if CInt(idx) = CInt(Trim(arrRead(i))) then
            dupliChk = true
        end if
    next
    if dupliChk = true then
        Response.Cookies("C_TABLE_NAME")("READ") = c_read_idx
    else
        Response.Cookies("C_TABLE_NAME")("READ") = c_read_idx & "," & idx
    end if
    CookieDuplicateCheck = dupliChk
End Function



If CookieDuplicateCheck("board", idx)=False Then 

'쿠키정보가 없을 때 처리

else

  '쿠키정보가 있을 때 처리

End If 

'ASP' 카테고리의 다른 글

ASP 달력 Calendar  (0) 2015.09.23
ASP 쿠키 로그인/로그아웃  (0) 2015.07.21
년월의 마지막 날짜(일) 구하기  (0) 2015.07.18
ASP 이미지 가로, 세로 크기 구하기  (0) 2015.01.19
페이지 초기번호  (0) 2015.01.04

ASP 달력 Calendar

ASP 2015. 9. 23. 14:48 Posted by Dayis

asp_calendar.zip


1. clsCalendar.asp
<%
Class Calendar
Private cShowDate
Private cValue
Private cBorder
Private cMonth
Private cYear
Private arrMonths(12)
Private cFonts
Private cFontSize
Private cShowNav
Private cShowForm

Private Sub  Class_Initialize()
cBorder = True
arrMonths(1) = "1"
arrMonths(2) = "2"
arrMonths(3) = "3"
arrMonths(4) = "4"
arrMonths(5) = "5"
arrMonths(6) = "6"
arrMonths(7) = "7"
arrMonths(8) = "8"
arrMonths(9) = "9"
arrMonths(10) = "10"
arrMonths(11) = "11"
arrMonths(12) = "12"

cValue = Now
cMonth = Month(Now)
cYear = Year(Now)
cFonts = "Verdana"
cFontSize = 2
cShowNav = False
cShowForm = False
cShowDate = False
End Sub

Private Sub Class_Terminate()

End Sub


Public Property Let Border(byRef uBorder)
cBorder = uBorder
End Property

Public Property Get Border()
Border = cBorder
End Property


Public Property Get Value()
Value = cValue
End Property

Public Property Let Value(byRef uValue)
cValue = uValue
cMonth = Month(uValue)
cYear = Year(uValue)
End Property


Public Property Let CalMonth(byRef uMonth)
cMonth = uMonth
End Property

Public Property Get CalMonth()
CalMonth = cMonth
End Property


Public Property Let CalYear(byRef uYear)
cYear = uYear
End Property

Public Property Get CalYear()
CalYear = cYear
End Property


Public Property Let Fonts(byRef uFonts)
cFonts = uFonts
End Property

Public Property Get Fonts()
Fonts = cFonts
End Property


Public Property Let FontSize(byRef uFontSize)
cFontSize = uFontSize
End Property

Public Property Get FontSize()
FontSize = cFontSize
End Property

Public Property Let ShowNav(byRef uShowNav)
cShowNav = uShowNav
End Property

Public Property Get ShowNav()
ShowNav = cShowNav
End Property


Public Property Let ShowForm(byRef uShowForm)
cShowForm = uShowForm
End Property

Public Property Get ShowForm()
ShowForm = cShowForm
End Property


Public Property Let ShowDate(byRef uShowDate)
cShowDate = uShowDate
End Property


Public Sub Display
If cShowNav or cShowForm Then

Select Case request("CalAction")

Case "back"
cYear = request("currYear")
If request("currMonth") < 1 Then
cMonth = 12
cYear = request("currYear") - 1
Else
cMonth = request("currMonth")
End If
Case "forward"

cYear = request("currYear")
If request("currMonth") > 12 Then
cMonth = 1
cYear = request("currYear") + 1
Else
cMonth = request("currMonth")
End If
Case "goto"

cMonth = request("currMonth")
If request("currYear") <> "" Then
cYear = Int(request("currYear"))
End IF

End Select
End If


cDay = Weekday(arrMonths(cMonth) & "/" & 1 & "/" & cYear)

Days = DaysInMonth()
If cBorder Then%>
<table border="0" cellpadding=0 style="width:100%;">
<tr>
<td bgcolor="#FFFFFF">
<%End If%>
<table border="0" cellspacing=1 cellpadding=1 style="width:100%;">
<tr>
<%If cShowNav Then%>

<td align="center" class="caldateprev"><a href="<%= Request.ServerVariables("SCRIPT_NAME") %>?CalAction=back&currMonth=<%=cMonth - 1%>&currYear=<%=cYear%>" style="text-decoration:none;" class="caldate">«</a></td>
<td colspan="5"align="center" class="caldate"><%=cYear%>년 <%=arrMonths(cMonth)%>월</td>
<td align="center" class="caldatenext"><a href="<%= Request.ServerVariables("SCRIPT_NAME") %>?CalAction=forward&currMonth=<%=cMonth + 1%>&currYear=<%=cYear%>" style="text-decoration:none;" class="caldate">»</a></td>

<%Else%>
<td colspan="7"align="center" bgcolor="#666666"><font color="#FFFFFF" size=<%=cFontSize%> face="<%=cFonts%>"><b><%=arrMonths(cMonth) & " " & cYear%></b></font></td>

<%End If%>
</tr>
<tr>
<td class="yoiltitle">일</td>
<td class="yoiltitle">월</td>
<td class="yoiltitle">화</td>
<td class="yoiltitle">수</td>
<td class="yoiltitle">목</td>
<td class="yoiltitle">금</td>
<td class="yoiltitle">토</td>
</tr>
<tr>
<%i = 1
For j = 1 to cDay - 1%>
<td class="calempty"></td>
<%If i > 6 Then
response.write("</tr><tr>")
i = 0
End If
i = i + 1
Next
For j = 1 to Days%>
<td class="calday <% If i=1 Then %>sunday<% ElseIf i=7 Then %>saturday<% End if %>"><%=j%></td>
<%If i > 6 And j <= Days - 1 Then
response.write("</tr><tr>")
i = 0
End If
i = i + 1
Next
If i > 1 Then
For m = i to 7%>
<td class="calempty"></td>
<%Next
End IF%>
</tr>
</table>
<%If cBorder Then%>
</td>
</tr>
</table>
<%End If
If cShowForm Then BottomForm
End Sub


Private Sub BottomForm%>
<table border="0" cellspacing=1 cellpadding=1 width=200>
<form method="GET" action="<%= Request.ServerVariables("SCRIPT_NAME") %>">
<tr>
<td align="right" width="25%"><font color="#000000" size=<%=cFontSize%> face="<%=cFonts%>"><b>Month</b></font></td>
<td>
<select name="currMonth">
<%For i = 1 to 12%>
<option value=<%=i%><%If i = Int(cMonth) Then response.write " Selected"%>><%=arrMonths(i)%></option>
<%Next%>
</select>
</td>
<td align="right" width="25%"><font color="#000000" size=<%=cFontSize%> face="<%=cFonts%>"><b>Year</b></font></td>
<td><input type="text" name="currYear" maxlength=4 size=4  value="<%=cYear%>"></td>
</tr>
<tr><td colspan=4 align="right"><input type="submit" value="GO"></td></tr>
<input type="hidden" name="calAction" value="goto">
</form>
</table>
<%
End Sub

Private Function DaysInMonth()
Select Case cMonth
Case 1,3,5,7,8,10,12
DaysInMonth = 31
Case 4,5,6,9,11
DaysInMonth = 30
Case 2
If cYear Mod 4 Then
DaysInMonth = 28
Else
DaysInMonth = 29
End If
Case Else
Exit Function
End Select
End Function
End Class
%>


2. calendar.asp

<!--#include virtual="/lib/clsCalendar.asp"--> 

<html> 

<head> 

<title>Calendar</title>

<style type="text/css">

.yoiltitle {

text-align:center;

font-size:12px;

color:#ffffff;

padding:5px;

background:#5E9253;

}


.sunday {

color:red;

}


.saturday {

color:blue;

}


.calempty {


}


.calday {

border:1px solid #c4c4c4;

width:14%;

background:#F8FAEE;

font-size:12px;

padding:5px;

height:50px;

vertical-align:top;

}


.caldate {

font-size:16px;

font-weight:bold;

color:#5E9253;

font-family:'굴림';

padding:10px;

}

</style>

</head> 

<body> 

<div align="center"> 

<% 

Set myCal = New Calendar 

mycal.border=false 'Display Border around Calendar 

mycal.value = Now 'Sets Current Date 

mycal.calMonth = month(date) 'Sets Current Month 

mycal.calYear = year(date) 'Sets Current Year 

mycal.fonts = "Tahoma" 'Sets Font 

mycal.fontSize=2 'Sets Font Size 

mycal.showDate = True 'Not yet implemented 

mycal.showNav =True 'Show prev and next Navigation Links 

mycal.showForm = False 'Show Month and Year form 

mycal.display 'Display Calendar 

Set myCal = Nothing 

%> 

</div>

<div style="height:30px;"></div><!-- iframe에서 하단이 짤리지 않도록 추가 -->

</body> 

</html>


'ASP' 카테고리의 다른 글

쿠키(Cookies) 중복 체크 및 처리  (0) 2015.11.07
ASP 쿠키 로그인/로그아웃  (0) 2015.07.21
년월의 마지막 날짜(일) 구하기  (0) 2015.07.18
ASP 이미지 가로, 세로 크기 구하기  (0) 2015.01.19
페이지 초기번호  (0) 2015.01.04

ASP 쿠키 로그인/로그아웃

ASP 2015. 7. 21. 04:30 Posted by Dayis

'로그인 시 

Response.Cookies("member").Domain = "도메인"

Response.Cookies("member").Path = "/"

Response.Cookies("member")("id") = trim(id)

Response.Cookies("member")("name") = trim(name)

Response.Cookies("member").Expires = date + 1

 

'로그아웃 시

Response.Cookies("member").Domain = "도메인"

Response.Cookies("member").Path = "/"

Response.Cookies("member")("id") = ""

Response.Cookies("member").Expires = date - 1

'ASP' 카테고리의 다른 글

쿠키(Cookies) 중복 체크 및 처리  (0) 2015.11.07
ASP 달력 Calendar  (0) 2015.09.23
년월의 마지막 날짜(일) 구하기  (0) 2015.07.18
ASP 이미지 가로, 세로 크기 구하기  (0) 2015.01.19
페이지 초기번호  (0) 2015.01.04

년월의 마지막 날짜(일) 구하기

ASP 2015. 7. 18. 14:36 Posted by Dayis

Function Get_Lastday(nYear, nMonth)

    Get_Lastday = Day(DateSerial(nYear, nMonth + 1, 1 - 1))

End Function

'ASP' 카테고리의 다른 글

ASP 달력 Calendar  (0) 2015.09.23
ASP 쿠키 로그인/로그아웃  (0) 2015.07.21
ASP 이미지 가로, 세로 크기 구하기  (0) 2015.01.19
페이지 초기번호  (0) 2015.01.04
ASP 문자열에서 HTML 제거 함수  (0) 2015.01.02

ASP 이미지 가로, 세로 크기 구하기

ASP 2015. 1. 19. 21:47 Posted by Dayis
출처 : http://www.taeyo.pe.kr/Forum/Content.aspx?SEQ=1328&TBL=KNOWHOW&PGN=8
Class ImageClass
	   
	   Private m_Width
	   Private m_Height
	   Private m_ImageType
	   Private BinFile

	   Private BUFFERSIZE
	   Private objStream

	   Private Sub class_initialize()
	   	   	   
	   	   BUFFERSIZE = 65535

	   	   ' Set all properties to default values
	   	   m_Width	   = 0
	   	   m_Height	   = 0
	   	   m_Depth	   = 0
	   	   m_ImageType = Null

	   	   Set objStream = Server.CreateObject("ADODB.Stream")

	   End Sub

	   Private Sub class_terminate()

	   	   Set objStream = Nothing

	   End Sub

	   Public Property Get Width()
	   	   Width = m_Width
	   End Property

	   Public Property Get Height()
	   	   Height = m_Height
	   End Property

	   Public Property Get ImageType()
	   	   ImageType = m_ImageType
	   End Property
	   
	   Private Function Mult(lsb, msb)
	   	   Mult = lsb + (msb * CLng(256))
	   End Function

	   Private Function BinToAsc(ipos)
	   	   BinToAsc = AscB(MidB(BinFile, (ipos+1), 1))	   
	   End Function 
	   
	   Public Sub LoadFilePath(strPath)
	   	   If InStr(strPath, ":") = 0 Then 
	   	   	   strPath = Server.MapPath(strPath)
	   	   End If 
	   	   
	   	   objStream.Open
	   	   objStream.LoadFromFile(strPath)
	   	   BinFile = objStream.ReadText(-1)

	   End Sub 

	   Public Sub LoadBinary(BinaryFile)

	   	   BinFile = BinaryFile
	   	   
	   End Sub 
	   	   
	   Public Sub ImageRead
	   	   
	   	   If  BinToAsc(0) = 137 And BinToAsc(1) = 80 And BinToAsc(2) = 78 Then
	   	   	   ' this is a PNG file
	   	   	   m_ImageType = "png"

	   	   	   ' get bit depth
	   	   	   Select Case BinToAsc(25)
	   	   	   	   Case 0
	   	   	   	   ' greyscale
	   	   	   	   	   Depth = BinToAsc(24)
	   	   	   	   Case 2
	   	   	   	   ' RGB encoded
	   	   	   	   	   Depth = BinToAsc(24) * 3
	   	   	   	   Case 3
	   	   	   	   ' Palette based, 8 bpp
	   	   	   	   	   Depth = 8
	   	   	   	   Case 4
	   	   	   	   ' greyscale with alpha
	   	   	   	   	   Depth = BinToAsc(24) * 2
	   	   	   	   Case 6
	   	   	   	   ' RGB encoded with alpha
	   	   	   	   	   Depth = BinToAsc(24) * 4
	   	   	   	   Case Else	   
	   	   	   	   ' This value is outside of it's normal range, so we'll assume that this is not a valid file
	   	   	   	   	   m_ImageType = Null
	   	   	   End Select

	   	   	   If not IsNull(m_ImageType) Then
	   	   	   	   ' if the image is valid then
        
	   	   	   	   ' get the width
	   	   	   	   m_Width = Mult(BinToAsc(19), BinToAsc(18))
           
	   	   	   	   ' get the height
	   	   	   	   m_Height = Mult(BinToAsc(23), BinToAsc(22))
	   	   	   End If
	   	   End If 

	   	   If BinToAsc(0) = 71 And BinToAsc(1) = 73 And BinToAsc(2) = 70 Then
	   	   	   ' this is a GIF file
	   	   	   m_ImageType = "gif"
        
	   	   	   ' get the width
	   	   	   m_Width = Mult(BinToAsc(6), BinToAsc(7))
        
	   	   	   ' get the height
	   	   	   m_Height = Mult(BinToAsc(8), BinToAsc(9))
        
	   	   	   ' get bit depth
	   	   	   m_Depth = (BinToAsc(10) And 7) + 1
	   	   End If
    
	   	   If BinToAsc(0) = 66 And BinToAsc(1) = 77 Then
	   	   	   ' this is a BMP file
    
	   	   	   m_ImageType = "bmp"
        
	   	   	   ' get the width
	   	   	   m_Width = Mult(BinToAsc(18), BinToAsc(19))
	           
	                   	    ' get the height
	   	   	   m_Height = Mult(BinToAsc(22), BinToAsc(23))
        
	   	   	   ' get bit depth
	   	   	   m_Depth = BinToAsc(28)
	   	   End If
	   
	   
	   	   If IsNull(m_ImageType) Then
	   	   	   ' if the file is not one of the above type then
	   	   	   ' check to see if it is a JPEG file
	   	   	   Dim lPos : lPos = 0
	   	   	   	   	   	   	   	   
	   	   	   Do
	   	   	   	   ' loop through looking for the byte sequence FF,D8,FF
	   	   	   	   ' which marks the begining of a JPEG file
	   	   	   	   ' lPos will be left at the postion of the start
	   	   	   	   If (BinToAsc(lPos) = &HFF And BinToAsc(lPos + 1) = &HD8 _  
	   	   	   	   	    And BinToAsc(lPos + 2) = &HFF) _
	   	   	   	   	    Or (lPos >= BUFFERSIZE - 10) Then Exit Do
	   	   	   	   
	   	   	   	   	   ' move our pointer up
	   	   	   	   	   lPos = lPos + 1
	   	   	   	   
	   	   	   	   	   ' and continue
	   	   	   Loop
	   	   	   	   
	   	   	   lPos = lPos + 2
	   	   	   If lPos >= BUFFERSIZE - 10 Then Exit Sub
	   	   	   
	   	   	   
	   	   	   Do
	   	   	   	   ' loop through the markers until we find the one 
	   	   	   	   ' starting with FF,C0 which is the block containing the 
	   	   	   	   ' image information
	   	   	   	   
	   	   	   	   Do
	   	   	   	   	   ' loop until we find the beginning of the next marker
	   	   	   	   	   If BinToAsc(lPos) = &HFF And BinToAsc(lPos + 1) _
	   	   	   	   	   	   <> &HFF Then Exit Do
	   	   	   	   	   	   lPos = lPos + 1
	   	   	   	   	   	   If lPos >= BUFFERSIZE - 10 Then Exit Sub
	   	   	   	   Loop
	   	   	   	   
	   	   	   	   ' move pointer up
	   	   	   	   lPos = lPos + 1
	   	   	   	   
	   	   	   	   If  (BinToAsc(lPos) >= &HC0 And BinToAsc(lPos) <= &HC3) Or _
	   	   	   	   (BinToAsc(lPos) >= &HC5 And BinToAsc(lPos) <= &HC7) Or _
	   	   	   	   (BinToAsc(lPos) >= &HC9 And BinToAsc(lPos) <= &HCB) Or _
	   	   	   	   (BinToAsc(lPos) >= &HCD And BinToAsc(lPos) <= &HCF) Then
	   	   	   	   	   Exit Do 
	   	   	   	   End If 

	   	   	   	   ' otherwise keep looking
	   	   	   	   lPos = lPos + Mult(BinToAsc(lPos + 2), BinToAsc(lPos + 1))
	   	   	   	   	   
	   	   	   	   ' check for end of buffer
	   	   	   	   If lPos >= BUFFERSIZE - 10 Then Exit Sub
	   	   	   	   	   
	   	   	   Loop
	   	   	   	   
	   	   	   ' If we've gotten this far it is a JPEG and we are ready
	   	   	   ' to grab the information.
	   	   	   	   
	   	   	   m_ImageType = "jpg"
	   	   	   	   
	   	   	   ' get the height
	   	   	   m_Height = Mult(BinToAsc(lPos + 5), BinToAsc(lPos + 4))
	   	   	   	   
	   	   	   ' get the width
	   	   	   m_Width = Mult(BinToAsc(lPos + 7), BinToAsc(lPos + 6))
	   	   	   	   
	   	   	   ' get the color depth
	   	   	   m_Depth = BinToAsc(lPos + 8) * 8
	   	   	   	   
	   	   End If
	   End Sub 
	   
End Class 

사용법입니다.

Dim Image
Set Image = new ImageClass
With Image
	   .LoadFilePath("가상경로 or 물리적 경로 어떤것을 입력하던 관계없습니다.")
	   .ImageRead
       iType = .ImageType
       iWidth = .Width
       iHeight = .Height
End With
Set Imaeg = Nothing 

또는...
Dim Image
Set Image = new ImageClass
With Image
	   Image.LoadBinary("바이너리로 읽었을때...")
	   .ImageRead
       iType = .ImageType
       iWidth = .Width
       iHeight = .Height
End With
Set Imaeg = Nothing 


'ASP' 카테고리의 다른 글

ASP 쿠키 로그인/로그아웃  (0) 2015.07.21
년월의 마지막 날짜(일) 구하기  (0) 2015.07.18
페이지 초기번호  (0) 2015.01.04
ASP 문자열에서 HTML 제거 함수  (0) 2015.01.02
ASP utf-8  (0) 2014.12.17

페이지 초기번호

ASP 2015. 1. 4. 00:13 Posted by Dayis

loop_idx = TotRecord - ((page-1)*PageSize)

'ASP' 카테고리의 다른 글

년월의 마지막 날짜(일) 구하기  (0) 2015.07.18
ASP 이미지 가로, 세로 크기 구하기  (0) 2015.01.19
ASP 문자열에서 HTML 제거 함수  (0) 2015.01.02
ASP utf-8  (0) 2014.12.17
ASP 프레임워크(Framework)  (0) 2014.12.05

ASP 문자열에서 HTML 제거 함수

ASP 2015. 1. 2. 14:26 Posted by Dayis

Function RemoveHTML( strText )

dim contTmp

    set tagfree = New Regexp

    tagfree.Pattern= "<[^>]+>"

    tagfree.Global=true

    strText=tagfree.Replace(strText,"")

    RemoveHTML= strText

End Function

'ASP' 카테고리의 다른 글

ASP 이미지 가로, 세로 크기 구하기  (0) 2015.01.19
페이지 초기번호  (0) 2015.01.04
ASP utf-8  (0) 2014.12.17
ASP 프레임워크(Framework)  (0) 2014.12.05
ASP 입력값 Replace (따옴표, 작은따옴표..)  (0) 2013.05.01

ASP utf-8

ASP 2014. 12. 17. 12:10 Posted by Dayis

1. 모든 ASP 코드 페이지 첫줄에 다음과 같은 코드를 추가합니다
<% @CODEPAGE="65001" language="vbscript" %>
<% session.CodePage = "65001" %>
<% Response.CharSet = "utf-8" %>
<% Response.buffer=true %>
<% Response.Expires = 0 %>
 
2. Meta 테그를 다음과 같이 추가 합니다.
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 
3. Response.ChaRset = "utf-8"  
ASP의 response.charset을 이용해서 문자 코드 세트명을 지정하는 부분 입니다.
설정시 <html> 태그 보다 앞에 선언 되어야 HTML 이 출력되면서 해당 속성을 인식하게 됩니다.

4. 에디트플러스나 울트라 에디터에서 수정후 저장할 때 반드시 Encoding 방식을 UTF-8 로 저장합니다
 
5.DB Insert/Update 시 숫자 타입을 제외한 모든 대상에 N을 추가 합니다
Insert 테이블이름 (칼럼a, 칼럼b) value (N'입력a', N'입력b')
update 테이블이를 set 칼럼a = N'입력a' where 고유칼럼 = '번호'
 
6.DB like 검색시 N 추가
 
7. 파일 첨부 DEXT Upload사용(영문으로 설치)
 SET uploadform = Server.CreateObject("DEXT.FileUpload")
 uploadform.DefaultPath = Server.MapPath(ESP_BBS_DATA)
 uploadform.CodePage = 65001
 wFileSize = 0
 rAttachment = uploadform("txtAttachFile")
 
 If Len(rAttachment) > 0 Then
  wFileName =  uploadform("txtAttachFile").FileName
  wFileSize =  uploadform("txtAttachFile").FileLen
 
  response.write uploadform.DefaultPath
  rAttachment = uploadform.SaveAs(uploadform.DefaultPath & "" & wFileName , False)
  rAttachment = UploadForm.LastSavedFileName
 End If
 
8. 파일 다운로드
 
<% @LANGUAGE='VBscRIPT' CODEPAGE='65001' %>
<%
 'Response.Charset = "UTF-8"
 filepath = Request.QueryString("txtFilepath") '// form으로 파라메터 전달해야 함.
 filename = Request.QueryString("txtFilename")'// form으로 파라메터 전달해야 함.
 
 If filepath = "" Then
  filepath=server.MapPath( Request.QueryString("txtFilename"))
  filename = Mid(filepath, InStrRev(filepath, "")+1)
 Else
  filepath=server.MapPath(filepath)
  filename =  Request.QueryString("txtFilename")
  If filename = "" Then
  filename = Request.QueryString("txtattachment")
  End If
 End If

 filepath = filepath &"" & filename
Call FileDown
%>
 
<%
Sub FileDown
' 참고http://www.taeyo.pe.kr/Lecture/20_TIps/Danny03.asp
 
 Response.Buffer = False
 Response.ContentType = "application/x-msdownload"
 'ContentType 를 선언합니다.
 'server.HTMLEncode
 'server.URLPathEncode
 Response.AddHeader "Content-Disposition","attachment; filename=" & server.URLPathEncode(filename) '//server.URLPathEncode 사용해야만 파일명 재대로 출력
 '헤더값이 첨부파일을 선언합니다.
 Set objStream = Server.CreateObject("ADODB.Stream")
 'Stream 을 이용합니다.
 objStream.Open
 '무엇이든 Set 으로 정의했으면 열어야 겠지요^^
 objStream.Type = 1
 objStream.LoadFromFile filepath
 '절대경로 입니다.
 download = objStream.Read
 Response.BinaryWrite download
 '이게 보통 Response.Redirect 로 파일로 연결시켜주는 부분을 대신하여 사용된 것입니다.
 Set objstream = nothing
 '초기화시키구요.
End Sub
%>
 
<%
Sub DEXTDown  ' DEXT.FileDownload 는 일본어 OS에 영문으로 설치시 한글파일 찾지 못함.(DextUpload 2.0까지는 그랬음)
 'On Error Resume Next
 Response.Buffer = False
 Response.AddHeader "Content-Disposition","inline;filename=" &  server.URLPathEncode(filename)
 set objFS = Server.CreateObject("scripting.FileSystemObject")

 set objF = objFS.GetFile(filepath)
 
 Response.AddHeader "Content-Length", objF.Size
 set objF = nothing
 set objFS = nothing
 Response.ContentType = "application/x-msdownload"
 Response.CacheControl = "public"
 Set objDownload = Server.CreateObject("DEXT.FileDownload")
 objDownload.Download filepath
 Set uploadform = Nothing
End Sub
%>
 
9. CDO Mail발송
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Const cdoSendUsingPort = 2 '1:로컬, 2:외부 smtp
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
Flds.item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25  '포트번호
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") =  "" 'ID
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") =  "" '암호

Flds.Update
Set iMsg.Configuration = iConf
iMsg.To = "xxxx@xxx.ccx" 'ToDo: Enter a valid email address.
iMsg.From = "xxxx@xxx.ccx"  'ToDo: Enter a valid email address.
iMsg.Subject = "This is a test CDOSYS message (Sent via Port 25)"
 
'iMsg..TextBody = strHTMLMsg '// 텍스트
iMsg.HTMLBody = strHTML  '// HTML 제목 깨짐 발생..

iMsg.BodyPart.Charset="UTF-8" '/// 한글을 위해선 꼭 넣어 주어야 합니다.
iMsg.HTMLBodyPart.Charset="UTF-8" '/// 한글을 위해선 꼭 넣어 주어야 합니다.
iMsg.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
 
 
10. ASP에서 배달 확인/ 읽음 확인 구현 방법 http://tong.nate.com/windeo/5767827

http://support.microsoft.com/default.aspx?scid=kb;ko;286430

<%
Set oMsg = CreateObject("CDO.Message")
oMsg.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
‘ 생성되는 메시지가 SMTP pickup 디렉터리가 아닌 SMTP 서비스로 전송되게 합니다.
oMsg.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "이름"
oMsg.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxxxx"
oMsg.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "seo-msg-01"
‘ 생성되는 메시지의 서버, 사서함 및 암호
oMsg.Configuration.Fields.Update

oMsg.From = "smpark@microsoft.com"
oMsg.To = "smpark@microsoft.com"

oMsg.Subject = "읽음 확인 및 배달 확인"
oMsg.DSNOptions = 14
‘ 이 메시지의 배달 상태 확인(delivery status notification:DSN)값으로 14는 배달 성공, 실패 및 지연시
‘ 확인메시지 생성
oMsg.Fields("urn:schemas:mailheader:return-receipt-to") = smpark@microsoft.com <mailto:smpark@microsoft.com>
‘ 받는 사람이 이 메시지를 열었을 때 읽음 확인 메시지가 여기에서 지정된 사람에게 보내집니다.
oMsg.Fields("urn:schemas:mailheader:disposition-notification-to") = smpark@microsoft.com <mailto:smpark@microsoft.com>
‘ MDN(Message Disposition Notification)은 이 메시지의 확인 메시지가 리턴 될 수신자를 지정합니다.
‘ MDN에 대하여는 Request for Comments (RFC) 2298에 자세히 설명됩니다.
oMsg.TextBody = " SMTP 서버를 통한 읽음 확인 및 배달 확인 메시지"
oMsg.Fields.Update
oMsg.Send

Set oMsg = Nothing
%>


11. 업로드 컴포넌트 UTF-8 지원여부 확인
SiteGalaxy(사이트 갤럭시) 및 ABC 업로드 :  utf-8을 지원하지 않음
덱스트업로드는 3.x 이후 지원

'ASP' 카테고리의 다른 글

페이지 초기번호  (0) 2015.01.04
ASP 문자열에서 HTML 제거 함수  (0) 2015.01.02
ASP 프레임워크(Framework)  (0) 2014.12.05
ASP 입력값 Replace (따옴표, 작은따옴표..)  (0) 2013.05.01
ASP 파라메터 컨트롤 함수  (0) 2012.01.09

ASP 프레임워크(Framework)

ASP 2014. 12. 5. 01:03 Posted by Dayis

ASP 프레임워크(Framework)


1. http://www.codeproject.com/Articles/7922/Classic-ASP-Framework-Make-your-Classic-ASP-co

AspFrameworkSourceCode.zip



2. http://simplicity.ws

Simplicity_Framework.zip


Simplicity_SampleSite.zip

'ASP' 카테고리의 다른 글

ASP 문자열에서 HTML 제거 함수  (0) 2015.01.02
ASP utf-8  (0) 2014.12.17
ASP 입력값 Replace (따옴표, 작은따옴표..)  (0) 2013.05.01
ASP 파라메터 컨트롤 함수  (0) 2012.01.09
jquery 파일 업로드  (0) 2010.12.10

ASP 입력값 Replace (따옴표, 작은따옴표..)

ASP 2013. 5. 1. 15:22 Posted by Dayis

function checkword(checkvalue)

  checkvalue = replace(checkvalue, "&", "&#38;")

  checkvalue = replace(checkvalue, """", "&#34;")

  checkvalue = replace(checkvalue, "'", "&#39;")

  checkvalue = replace(checkvalue, chr(13),"<br>"+chr(13))

  checkword = checkvalue

end function

'ASP' 카테고리의 다른 글

ASP utf-8  (0) 2014.12.17
ASP 프레임워크(Framework)  (0) 2014.12.05
ASP 파라메터 컨트롤 함수  (0) 2012.01.09
jquery 파일 업로드  (0) 2010.12.10
구글맵  (0) 2010.12.09