Anti-cheating very strong voting system mechanism source code

Source: Internet
Author: User
Tags servervariables
Source Code | cheating | Voting system This is the previous page of the voting code. Click on this page to vote.
<%
Response.Cookies ("cook") = "yes"
%>
Here is the voting page code
<%
ifRequest.Cookies ("Cook") <> "yes" then
Response.Write "<script language= ' JavaScript ' >alert (' Cookies are not open for voting '); location.href= '" &url& "; </script> "
Else
method = Request.ServerVariables ("Request_method")
ifMethod <> "POST" Then
Response.Write "<script language= ' JavaScript ' >alert (' please vote in normal way '); location.href= '" &url& "; </ Script> "
Else
url = Request. ServerVariables ("Http_referer") ' Get the address of the previous page
Dim RegEx, RetVal
Set regEx = New RegExp
Regex.pattern = "^http://([^/]*.)? chinabbs.com/[\s\s]*$"
Regex.ignorecase = True
RetVal = regex.test (URL)
ifRetVal Then
id = request.querystring ("id") ' Get user ID '
Userip = Request.ServerVariables ("remote_addr") ' Recording voting User IP
Set Rs=server.createobject ("Adodb.recordset") ' Set up a recordset
sql = "SELECT * from vote where userip= '" &userip& "and DateDiff (' H ', Datestr,now) <3"
Rs.Open sql,conn,2,2
ifNot (RS.BOF and rs.eof) then
Response.Write "<script language= ' JavaScript ' >"
Response.Write "alert (' Sorry! You can vote again every 3 hours! ');"
Response.Write "Javascript:history.back ( -1);</script>"
Else' Otherwise the database has no current user IP and voting time is not more than 3 hours
Rs.close
ifRequest.Cookies ("i") <>1 then
ifSession ("I") <>1 then
Datestr=now () ' Gets the current system date value to the DATESTR variable
SessionID = Session.SessionID
sql = "INSERT into vote (Username,userip,datestr,sessionid) VALUES (' &id&" ', ' "&userip&" ', ' "& datestr& "', '" &sessionid& ")"
Conn.execute SQL
sql = "Update proid set hits = hits + 1 where userid= '" &id& ""
Conn.execute SQL
Session ("I") =1
Response. Cookies ("I") =1
Response.Cookies ("i"). Expires=dateadd ("H", 3,now ())
End If
End If
Response.Write "<script language= ' JavaScript ' >"
Response.Write "Alert (' Congratulations! Vote for Success! Location.href= ' "&url&" ';</script> "
End If
Else
Response.Write "<script language= ' JavaScript ' >alert (' please vote in normal way '); location.href= '" &url& "; </ Script> "
End If
End If
End If
%>
Post mode pass parameters, vote in the station, IP record judgment, session judgment, cookies judgment.
If you restart the cat, change the IP, do not close the browser. Then the session judge does not let the vote.
If you restart the cat, change the IP, close the browser, disable cookies, then don't let the vote.
If you restart the cat, change the IP, close the browser, delete cookies, open the browser, what will be the result?????? What to do ...

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.