发信人: nonepassby(左右無人)
整理人: qcrsoft(2002-05-13 16:33:26), 站内信件
|
<%
'在下面的application("cookiedomain")和application("cookiepath")中的值
'可以通过server variable来预先设置
'
'AddCookie(Cname,CKey,CValue,CExpDays)为增加cookie函数
'例如:Call AddCookie("MyCookie","Cost","cost","$1.00",100)
'
'KillCookie(Cname,CKey)为删除一个cookie
'例如:Call KillCookie("MyCookie","Cost")
'
'GetCookie(Cname,CKey)为取得一个Cookie
'例如:Call GetCookie("MyCookie","Cost")
'
'Cname:为Cookie的名字
'Ckey:为Cookie子键
'CValue:为要设置的值
'CExpDays:Cookie Expiration(cookie的有效期天数)默认为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_NAMW")
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
%>
---- 網易之左右無人给我留言
为了与更多的朋友交流,我已申请脚本技术版版卒 |
|