home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2000 September
/
PCWorld_2000-09_cd.bin
/
Software
/
Topware
/
aspedit
/
_SETUP.1
/
cookielib.inc
< prev
next >
Wrap
Text File
|
1998-12-22
|
3KB
|
81 lines
<%
'=======================================================================
' application("cookiedomain") and application("cookiepath") can be
' set if firewall precludes accurate server variable
'
' AddCookie(Cname, CKey, CValue, CExpDays)
' Example: Call AddCookie("MyCookie", "Cost", "$1.00", 100)
'
' KillCookie(Cname,CKey)
' Example: Call KillCookie("MyCookie", "Cost")
'
' GetCookie(Cname,Ckey)
' Example: Call GetCookie("MyCookie", "Cost")
'
' Cname = Cookie Name: Required, for cookie name
' Ckey = Cookie Key: Optional(empty sting), use if cookie should be a dictionary
' Cvalue = Cookie Value: Required, what the cookie should be set to.
' CExpDays = Cookie Expiration: number of days cookie is valid, default 365
'=======================================================================
Function AddCookie(Cname, CKey, CValue, CExpDays)
If Cname = "" Then
Exit Function
End If
If IsNumeric(CExpDays) = False Then CExpDays = 0
If CExpDays < 1 Then CExpDays = 365
If CValue = "" Then CValue = " "
If CKey <> "" Then
Response.Cookies(Cname)(CKey) = CValue
Else
Response.Cookies(Cname) = CValue
End If
Response.Cookies(CName).Expires = Date + CExpDays
Response.Cookies(CName).Domain = GetCookieDomain()
Response.Cookies(CName).Path = GetCookiePath()
End Function
Function KillCookie(Cname,CKey)
If CKey <> "" Then
Call AddCookie(Cname, Ckey, "", 0)
Else
Response.Cookies(Cname).Expires = Date - 365
Response.Cookies(CName).Domain = GetCookieDomain()
Response.Cookies(CName).Path = GetCookiePath()
End If
End Function
Function GetCookie(Cname, Ckey)
If CKey <> "" Then
GetCookie = Request.Cookies(Cname)(Ckey)
Else
GetCookie = Request.Cookies(Cname)
End If
End Function
Function GetCookieDomain()
If Application("CookieDomain") <> "" Then
GetCookieDomain = Application("CookieDomain")
Else
GetCookieDomain = Request.ServerVariables("SERVER_NAME")
End If
End Function
Function GetCookiePath()
If Application("CookiePath") <> "" Then
GetCookiePath = Application("CookiePath")
Else
TmpPath = Request.ServerVariables("SCRIPT_NAME")
TmpPath = Split(TmpPath, "/")
For PathArryCnt = 0 to Ubound(TmpPath) - 1
GetCookiePath = GetCookiePath & TmpPath(PathArryCnt) & "/"
Next
If GetCookiePath = "/" Then GetCookiePath = ""
End If
End Function
%>