<%
Dim Referer, usercookie
Dim mydomain, reurl, oldip, oldtime
Dim opentime, adstr
opentime = 24 '设定同一IP弹窗周期,单位:小时
mydomain = "tiancao.net" '网站域名
adstr = "<script language=""javascript"" src=""http://c1.eteun.cn/fshow.php?id=34861" ... #115;cript>"' 广告联盟弹窗代码
Referer = CStr(Request.ServerVariables("HTTP_REFERER")) '取得访问来源
If (Referer = "") Then '如果为空判断是直接访问,否则为通过搜索引擎或其它网站进入
reurl = "search"
Else
If InStr(Referer, mydomain) > 0 Then
reurl = mydomain
Else
reurl = "search"
End If
End If
If reurl = "search" Then '如果用户是通过外部链接进到本站时就判断是否超过24小时后弹窗
If Trim(Request.Cookies("isopen")("user")) = "" Then '如果用户第一次访问弹窗
Call writecookie '记录Cookie并弹窗操作过程
Else
usercookie = Trim(Request.Cookies("isopen")("user"))
If InStr(Trim(Request.Cookies("isopen")("user")), "|") > 0 Then '如果有cookie内容就判断格式是否正确,否则转入弹窗
oldip = Split(usercookie, "|")(0) 'cookie里的上次弹窗的IP记录
oldtime = Split(usercookie, "|")(1) 'cookie里的上次弹窗的时间记录
If Trim(oldip) = Trim(UserIP()) Then '如同上次弹窗IP与现IP一样就判断时间差
If DateDiff("h", oldtime, Now()) > opentime Then '如果时间超过24小时就弹窗
Call writecookie '记录Cookie并弹窗操作过程
Else
'时间没超过弹窗周期不操作
End If
Else '新IP访问弹窗
Call writecookie '记录Cookie并弹窗操作过程
End If
Else
Call writecookie
End If
End If
End If
Sub writecookie()
Response.Cookies("isopen").Expires = Now + 1
Response.Cookies("isopen")("user") = UserIP() & "|" & Now()
Response.Write adstr
End Sub
Function UserIP()
Dim GetClientIP
GetClientIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If GetClientIP = "" Or IsNull(GetClientIP) Or IsEmpty(GetClientIP) Then
GetClientIP = Request.ServerVariables("REMOTE_ADDR")
End If
UserIP = GetClientIP
End Function
%>
Dim Referer, usercookie
Dim mydomain, reurl, oldip, oldtime
Dim opentime, adstr
opentime = 24 '设定同一IP弹窗周期,单位:小时
mydomain = "tiancao.net" '网站域名
adstr = "<script language=""javascript"" src=""http://c1.eteun.cn/fshow.php?id=34861" ... #115;cript>"' 广告联盟弹窗代码
Referer = CStr(Request.ServerVariables("HTTP_REFERER")) '取得访问来源
If (Referer = "") Then '如果为空判断是直接访问,否则为通过搜索引擎或其它网站进入
reurl = "search"
Else
If InStr(Referer, mydomain) > 0 Then
reurl = mydomain
Else
reurl = "search"
End If
End If
If reurl = "search" Then '如果用户是通过外部链接进到本站时就判断是否超过24小时后弹窗
If Trim(Request.Cookies("isopen")("user")) = "" Then '如果用户第一次访问弹窗
Call writecookie '记录Cookie并弹窗操作过程
Else
usercookie = Trim(Request.Cookies("isopen")("user"))
If InStr(Trim(Request.Cookies("isopen")("user")), "|") > 0 Then '如果有cookie内容就判断格式是否正确,否则转入弹窗
oldip = Split(usercookie, "|")(0) 'cookie里的上次弹窗的IP记录
oldtime = Split(usercookie, "|")(1) 'cookie里的上次弹窗的时间记录
If Trim(oldip) = Trim(UserIP()) Then '如同上次弹窗IP与现IP一样就判断时间差
If DateDiff("h", oldtime, Now()) > opentime Then '如果时间超过24小时就弹窗
Call writecookie '记录Cookie并弹窗操作过程
Else
'时间没超过弹窗周期不操作
End If
Else '新IP访问弹窗
Call writecookie '记录Cookie并弹窗操作过程
End If
Else
Call writecookie
End If
End If
End If
Sub writecookie()
Response.Cookies("isopen").Expires = Now + 1
Response.Cookies("isopen")("user") = UserIP() & "|" & Now()
Response.Write adstr
End Sub
Function UserIP()
Dim GetClientIP
GetClientIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If GetClientIP = "" Or IsNull(GetClientIP) Or IsEmpty(GetClientIP) Then
GetClientIP = Request.ServerVariables("REMOTE_ADDR")
End If
UserIP = GetClientIP
End Function
%>
[本日志由 tiancao1001 于 2009-02-08 09:48 PM 编辑]
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |