How to write this code using php?

Source: Internet
Author: User
Tags servervariables
How to write this code using php & lt; % Response. expires =-1Response. addHeader & quot; pragma & quot;, & quot; no-cache & quot; Response. addHeader & quot; how to write the cach code using php?
<%
Response. Expires =-1
Response. AddHeader "pragma", "no-cache"
Response. AddHeader "cache-control", "no-store"
%>




<%'
'------- This page is used to promote connections

'%>
<%
Dim nextpage
Dim vipurl' promotion connection
Dim JF_Rule_TimeDiff, JF_Rule_Count, JFValue_Every 'interval, the number of valid clicks within the interval, and the points obtained by each valid click
Dim SQL 'defines the executed SQL statement
Dim rs 'define rs
Dim userid, validcount 'user number, the number of valid accesses in a time period
Dim IP, URL 'Client ip address and I source url
Dim logincount
Whether dim isvalid is valid
Dim LoginIPArea, login_Url 'region of the client ip address, source url
Login_Url = "" 'initialize the URL
LoginIPArea = "" 'initialize the client ip area
Login_Url = Request. ServerVariables ("HTTP_REFERER ")'
Nextpage = "script location. href = 'p _ center. asp '; script"' defines the page to jump.
'Response. write login_Url
'Response. end
If len (login_Url)> 0 then' source url processing process
Login_Url = replace (login_Url, "http ://","")
Login_Url = split (login_Url ,"/")
Login_Url = login_Url (0)
End if
Isvalid = 1
Validcount = 0
Logincount = 0
Vipurl = request ("vip ")
IP = Request. ServerVariables ("HTTP_X_FORWARDED_FOR") 'get the client ip address
If IP = "" Then IP = Request. ServerVariables ("REMOTE_ADDR") 'IP Address processing
'IP = getIP ()
LoginIPArea = GetIpArea (IP)

'Response. write ("ip:" & IP &"
")
'Response. write ("vip:" & vipurl)

Set rs = server. createobject ("adodb. recordset") 'create an rs object
Set rsuser = server. createobject ("adodb. recordset") 'create an rs object
SQL = "select JF_Rule_TimeDiff, JF_Rule_Count, JFValue_Every from JF_Rule"
Rs. open SQL, conn, 1, 1
'The process of obtaining system parameters
If not rs. eof then
JF_Rule_TimeDiff = rs ("JF_Rule_TimeDiff") 'interval
JF_Rule_Count = rs ("JF_Rule_Count") 'valid clicks during the interval
JFValue_Every = rs ("JFValue_Every") 'points that are valid for each click
End if
Rs. close
If (len (vipurl) = 0) then ',
'Jump ----- write the jump page here
Response. write nextpage
Response. end
Else 'is a promotional connection that is valid for users.
SQL = "select User_ID, User_Code, User_UserName, User_Login_time, User_Login_IP, User_Login_Count from C_User where User_Code = '" & vipurl &"'"
Rs. open SQL, conn, 1, 1
If not rs. eof then
Userid = rs ("User_ID ")
', User_FromUser, User_JF, User_ToUserCount, User_ToAllCount

Else
'Jump ----- write the jump page here
Response. write nextpage
Response. end
End if
Rs. close
End if
'--------- The number of valid clicks. the following shows whether the click is valid.
SQL = "select isnull (count (1), 0) as logincount from User_GetJF where LoginIP = '" & IP & "' and datediff (hour, LoginTime, cast ('"& now () &"' as datetime) <= "& JF_Rule_TimeDiff &""
'Response. write SQL
'Response. end
Rs. open SQL, conn, 1, 1
If not rs. eof then
Logincount = rs ("logincount") 'to obtain the number of valid clicks
End if
If (logincount> = JF_Rule_Count) then' is invalid if the number of clicks exceeds the system parameter setting
Isvalid = 0
End if
Rs. close
SQL = "insert into User_GetJF (User_ID, User_GetJFValue, User_GetMethod, LoginIP, LoginIPArea, IsValid, login_Url) values (" & userid & "," & Tags & ", 'promotional access ', '"& IP &"', '"& LoginIPArea &"', "& isvalid &", '"& login_Url &"')"
'Write the user promotion detail table
Rs. open SQL, conn

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.