[Original] 24 hours the same IP only play window source code

Source: Internet
Author: User
Tags reference servervariables split trim window
Original | source code | Bomb window

<%
' Author: Arisisi
' URL: http://www.alixixi.com
' Description: Welcome to use source Code program, please keep this information.
' 24 hours with 1IP only once
' Direct input to the Web site does not play
' Once you've played it, don't play it when you open another page with the Bullet window code.
' It's best to use the JS reference, so you can also use the static page
Dim Viewhistory,referer,usercookie
Dim Mydomain,reurl,oldip,oldtime
Dim Opentime,adstr
Opentime = 24 ' Set the same IP window cycle, unit: Hours
MyDomain = "alixixi.com" ' website domain name
Adstr = "<script language=" "JavaScript" "src=" "Http://alixixi.com/indexgg.js" "></script>" Ad League window code, <script>...</script> similar window code, pay attention to the single double quotes

Referer = CStr (Request.ServerVariables ("Http_referer")) ' Get access source
if (referer= "") Then ' if NULL to judge is direct access, otherwise enter through search engine or other website
Reurl=mydomain
Else
If InStr (Referer,mydomain) > 0 Then
Reurl=mydomain
Else
Reurl= "Search"
End If
End If
If Reurl = "Search" Then "if the user is through the external link to the site to determine whether more than 24 hours after the rebound window
If Trim (Request.Cookies ("IsOpen") ("user") = "then" if the user accesses the window for the first time
Call Writecookie () ' record cookie and play window operation process
Else
Usercookie = Trim (Request.Cookies ("IsOpen") ("user")
If InStr (Trim (Request.Cookies ("IsOpen") ("User"), "|") >0 Then ' If there is a cookie content to determine whether the format is correct, otherwise go to the bomb window
Oldip = Split (Usercookie, "|") (0) ' The IP record of the last pinball window in the cookie
Oldtime = Split (Usercookie, "|") (1) ' The time record of the last pinball window in the cookie
If trim (OLDIP) = Trim (Userip ()) Then ' as the last time the window IP and current IP to judge the difference
If DateDiff ("H", Oldtime,now ()) >opentime then ' if time exceeds 24 hours on the window
Call Writecookie () ' record cookie and play window operation process
Else
' Time does not exceed the window cycle does not operate
End If
Else ' New IP access bomb window
Call Writecookie () ' record cookie and play window operation process
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 "document.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
%>

Reference mode: <script src= "above code filename alixixi.com.asp" ></script>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.