整合在动网论坛里的,实现对每个回复进行投票,代码写的很烂,见笑了
<link href="../style.css" rel="stylesheet" type="text/css">
<!--#i nclude file="conn1.asp"-->
<%
id=trim(request.querystring("userid"))
username=trim(request.querystring("username"))
Caption=trim(request.querystring("caption"))
come_ip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
if come_ip = "" then
come_ip=Request.ServerVariables("remote_addr")
end if
if instr(come_ip,"'")>0 then
come_ip="0.0.0.0"
end if
'+==========================================================+
'+==========================================================+
on error resume next
set rs1=server.createobject("adodb.recordset")
sql = "select * from tpip where ip='" & come_ip & "'"
rs1.open sql,conn,1,3
total=rs1.recordcount
rs1.movelast
if total >0 and abs((DateDiff("n", Now, rs1("dtime"))))>2 then
set rs2=server.createobject("ADODB.recordset")
sql="select * from Dv_bbs1 where postuserid=" & id & "and dateandtime=#" & caption & "# "
rs2.open sql,conn,1,2
rs2("isvote")=rs2("isvote")+1
response.write "您已经为" & username & "投票成功"
response.write abs((DateDiff("n", Now, rs1("dtime"))))
rs1.movelast
rs2.update
rs2.close
rs1.close
set rs=server.createobject("ADODB.recordset")
rs.Open "select * from tpip",conn,1,3
rs.addnew
rs("ip")=come_ip
rs("dtime")=now()
rs.update
rs.movelast
rs.close
elseif total <0 then
set rs2=server.createobject("ADODB.recordset")
sql="select * from Dv_bbs1 where postuserid=" & id & "and dateandtime=#" & caption & "# "
rs2.open sql,conn,1,2
rs2("isvote")=rs2("isvote")+1
response.write "您已经为" & username & "投票成功"
rs2.update
rs2.close
set rs=server.createobject("ADODB.recordset")
rs.Open "select * from tpip",conn,1,3
rs.addnew
rs("ip")=come_ip
rs("dtime")=now()
rs.update
rs.close
rs1.movelast
Else
response.Redirect("index.asp")
end if
<%sub Error() %>
<script language="J***aScript">
alert(' 您已经投过1次票了,请不要重复投票!')
window.history.go(-1);
</script>
<%end sub%>