📄 photovote.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<% response.charset="utf-8" %>
<!--#include file="../Include/NoSqlHack.asp" -->
<!--#include file="../Include/Const.asp" -->
<!--#include file="../Include/ConnSiteData.asp" -->
<%
dim rs,sql,ipclock,Loginhits,MemName,numbers,memclock
set rs = server.createobject("adodb.recordset")
sql="select top 1 * from ameav_Site"
rs.open sql,conn,1,1
ipclock=rs("ipclock")
memclock=rs("memclock")
numbers=rs("numbers")
rs.close
if ipclock=0 then
response.write "<script language=javascript> alert('投票结束,谢谢大家的支持!');location.replace('main.asp');</script>"
response.end()
end if
if memclock=1 then
MemName=session("MemName")
set rs = server.createobject("adodb.recordset")
sql="select * from ameav_Members where MemName='"&MemName&"'"
rs.open sql,conn,1,3
rs("Loginhits")=rs("Loginhits")+1
Loginhits=rs("Loginhits")
rs.update
rs.close
if Loginhits>=numbers then
response.write "<script language=javascript> alert('每个用户只能投20票,谢谢你宝贵的一票!');location.replace('main.asp');</script>"
response.end()
end if
end if
dim id,LoginSoft,LoginTime,uname
LoginSoft=Request.ServerVariables("Http_USER_AGENT")
LoginTime=now()
uname=Request("name")
function getip() '获得客户端IP
getip=Request.ServerVariables("REMOTE_ADDR")
end function
if memclock=1 then
function cip(ip,id,vt,MemName)
sql="Select * from ameav_Vote where ip='"&ip&"' and pid="&id&" and vtime='"&vt&"' and MemName='"&MemName&"'"
Set rs=conn.execute(sql)
if not rs.eof then
cip=true
else
cip=false
end if
end function
sub jip(ip,vt,id) '记录投票信息
sql="Insert into ameav_Vote(ip,vtime,pid,MemName) values('"&ip&"','"&vt&"',"&id&",'"&MemName&"')"
conn.execute(sql)
end sub
sub delip(vt) '删除指定时间之前的投票信息
sql="delete from ameav_Vote where vtime<'"&vt&"'"
conn.execute(sql)
end sub
'==========================================
id=Request("id")
if id="" or id=null or not isnumeric(id) then
Response.write "<script language='javascript'>alert('参数错误');history.go(-1);</script>"
Response.End()
end if
call delip(date()) '删除前一天的投票数据
ip=getip() '获得客户IP
if cip(ip,id,date(),MemName)=true then '检测指定IP在今天是否给指定的ID投过票
Response.write "<script language='javascript'>alert('你今日已经给这位人物投票,不能继续投票!一天只能投票一次!');history.go(-1);</script>"
Response.End()
end if
else
function cip(ip,id,vt)
sql="Select * from ameav_Vote where ip='"&ip&"' and pid="&id&" and vtime=#"&vt&"#"
Set rs=conn.execute(sql)
if not rs.eof then
cip=true
else
cip=false
end if
end function
sub jip(ip,vt,id) '记录投票信息
sql="Insert into ameav_Vote(ip,vtime,pid) values('"&ip&"',#"&vt&"#,"&id&")"
conn.execute(sql)
end sub
sub delip(vt) '删除指定时间之前的投票信息
sql="delete from ameav_Vote where vtime<#"&vt&"#"
conn.execute(sql)
end sub
'==========================================
id=Request("id")
if id="" or id=null or not isnumeric(id) then
Response.write "<script language='javascript'>alert('参数错误');history.go(-1);</script>"
Response.End()
end if
call delip(date()) '删除前一天的投票数据
ip=getip() '获得客户IP
if cip(ip,id,date())=true then '检测指定IP在今天是否给指定的ID投过票
Response.write "<script language='javascript'>alert('你今日已经给这位人物投票,不能继续投票!一天只能投票一次!');history.go(-1);</script>"
Response.End()
end if
end if
set rs=server.createobject("adodb.recordset")
rs.Open "Select * from ameav_Products where id="&id,conn,1,3
if rs.eof then
Response.write "<script language='javascript'>alert('参数错误');history.go(-1);</script>"
Response.End()
else
rs("ClickNumber")=rs("ClickNumber")+1
rs.update
end if
rs.Close
set rs = server.createobject("adodb.recordset")
sql="select * from ameav_Voteip"
rs.open sql,conn,1,3
rs.addnew
rs("ProductName")=uname
rs("IP")=IP
rs("LoginSoft")=LoginSoft
rs("AddTime")=LoginTime
rs.update
rs.close
set rs=nothing
call jip(ip,date(),id) '记录投票信息
Response.Redirect("ProductVote_do.asp?id="&id)
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -