这个网站是一个投票的,一个是赞成,一个是反对。http://www.hfweb.cn/civi/Show.asp?ID=7,如果投赞成票,一天只能投一次,必须第二天才能投第二票,改时间没用,清空COOKIE也没有用。不知道这个COOKIE怎么写的。请高手指点。
解决方案 »
- 请教tomcat下做SSL双向认证?
- JAVA :一个链接已经打开一个窗体 再点击该链接 如何只打开第一次点击链接打开的那个窗体
- jsp如何实现像qq加载的时候在右下角弹出一个小窗体
- 在同一个工程里用连接池连接数据库的时候提示不能加载驱动
- jsp中的每月的1号
- 帮忙看看什么错误,java.lang.ClassCastException
- 为什么我在Servlet中放置在session对象中的ArrayList对象在JSP页中取不出来!
- TOMCAT 4.0.6 的一个好玩的现象 :)
- tomcat4.1.7问题
- 在jsp中如何读取文本文件中的字符?急!
- 超强版status,不看看 你就不知道天有多高!
- jijiji
做到上面这一步就行了。再高级点可以往手机里发验证码,这个就太费事了,估计就没有人愿意投票了。
应该不是保存到数据库中的,因为我禁用了cookie后,网站就会提示不能投票,要开户cookie.
试过了。不行的。IP换了,COOKIE也清了。
<HTML><HEAD><TITLE>WMI Scripting HTML</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<SCRIPT language=JScript event="OnCompleted(hResult,pErrorObject, pAsyncContext)" for=foo>
document.forms[0].txtMACAddr.value=unescape(MACAddr);
document.forms[0].txtIPAddr.value=unescape(IPAddr);
document.forms[0].txtDNSName.value=unescape(sDNSName);
//document.formbar.submit();
</SCRIPT>
<SCRIPT language=JScript event=OnObjectReady(objObject,objAsyncContext) for=foo>
if(objObject.IPEnabled != null && objObject.IPEnabled != "undefined" && objObject.IPEnabled == true)
{
if(objObject.MACAddress != null && objObject.MACAddress != "undefined")
MACAddr = objObject.MACAddress;
if(objObject.IPEnabled && objObject.IPAddress(0) != null && objObject.IPAddress(0) != "undefined")
IPAddr = objObject.IPAddress(0);
if(objObject.DNSHostName != null && objObject.DNSHostName != "undefined")
sDNSName = objObject.DNSHostName;
}
</SCRIPT>
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY>
<OBJECT id=locator classid=CLSID:76A64158-CB41-11D1-8B02-00600806D9B6 VIEWASTEXT></OBJECT>
<OBJECT id=foo classid=CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223></OBJECT>
<SCRIPT language=JScript>
var service = locator.ConnectServer();
var MACAddr ;
var IPAddr ;
var sDNSName;
service.Security_.ImpersonationLevel=3;
service.InstancesOfAsync(foo, 'Win32_NetworkAdapterConfiguration');
</SCRIPT>
<FORM id="formfoo" name="formbar" action="index.do" method="post">
<INPUT value="00-11-11-B4-52-EF" name="txtMACAddr">
<INPUT value="210.42.38.50" name="txtIPAddr">
<INPUT value="zhupan" name="txtDNSName">
</FORM></BODY></HTML>
option explicit
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = -1
Response.CacheControl = "no-cache"
const ZanTime=1 '赞成票投票时间
const FanTime=2
const TimeDanWei="d"'时间间隔的单位天
const TimerStr="天"
dim JianTime,Action,AlertStr,UserID
Action=Hu_Clng(request("Action"))
if ACtion>4 or Action<2 then Action=4
UserID=request.Cookies("Civi")
if UserID="" then
AlertStr="浏览器cookies功能未打开、手动清除了cookies或系统还原"
end if
ComeUrl = Trim(Request.ServerVariables("HTTP_REFERER"))
if ComeUrl="" then
AlertStr="不允许直接输入地址访问本系统"
elseif LCase(Trim("http://" & Request.ServerVariables("SERVER_NAME")))<>LCase(Left(ComeUrl, InStr(8,ComeUrl, "/")-1)) then
AlertStr="不允许从外部链接地址访问本系统"
end if
if AlertStr<>"" then
response.Write "<script language='javascript'>alert("""&AlertStr&""");window.location="""&comeurl&""";</script>"
response.end()
end if
%>
<!--#include file="conn_tupiao.asp" -->
<!--#include file="civicode.asp" -->
<%
select case Action
case 3
JianTime=ZanTime
call Zan("ZanChen")
case 4
JianTime=FanTime
call Zan("FanDui")
end select
call CloseConn_tupiao()
if AlertStr<>"" then
response.Write "<script language='javascript'>alert("""&AlertStr&""");window.location="""&comeurl&""";</script>"
response.end()
end ifsub Zan(str)
dim TuPiao,idArr,i,ErrStr,sql,SucStr,rs,DanWeiName
dim NowTime,s1,s2,s3,timestr,UserStr
NowTime=now()
tuPiao=Hu_clng(request.QueryString("tuPiao"))
if tuPiao<=0 then
AlertStr="您没有选择任何单位"
exit sub
end if
set rs=conn_tupiao.execute("select DanWeiName,TuDate from YongFu where userID='"&userID&"'")
if rs.eof then'未找到记录,手动修改了cookies
set rs=nothing
response.Cookies("Civi")=""
AlertStr="浏览器cookies功能未打开或手动修改了cookies"
exit sub
else'找到记录,需要检查投票情况
if datediff(TimeDanWei,rs("TuDate"),NowTime)<jianTime then
AlertStr="您访问本系统未达到"&jianTime&TimerStr&",请过"&jianTime-datediff(TimeDanWei,rs("TuDate"),NowTime)&TimerStr&"后再来投票,谢谢!"
set rs=nothing
exit sub
end if
On Error Resume Next
DanWeiName=trim(rs("DanWeiName"))
set rs=nothing
if isnull(DanWeiName) then DanWeiName=""
UserStr=DanWeiName
s1=instr(DanWeiName,"["&TuPiao&"$")
if s1>0 then'以前对该单位投过票
s2=instr(s1,DanWeiName,"]")
timestr=replace(mid(DanWeiName,s1,s2-s1),"["&TuPiao&"$","")
if not IsDate(timeStr) then
set rs=nothing
AlertStr="系统出错,请与管理员联系!"
exit sub
end if
if DateDiff(TimeDanWei,timestr,NowTime)<JianTime then
ErrStr=TuPiao
else
SucStr=TuPiao
UserStr=replace(DanWeiName,"["&TuPiao&"$"×tr&"]","["&TuPiao&"$"&NowTime&"]")
end if
else
SucStr=TuPiao
UserStr=DanWeiName&"["&TuPiao&"$"&NowTime&"]"
end if
end if
set rs=nothing
if SucStr="" and ErrStr="" then
AlertStr="您没有选择任何单位"
exit sub
end if
if SucStr<>"" then
'将用户投票情况写入数据库
if UserStr="" then
AlertStr="系统出错!"
exit sub
end if
sql="update YongFu set DanWeiName='"&UserStr&"' where UserID='"&UserID&"'"
conn_tupiao.execute sql
'开始进行投票
sql="update DanWei set "&str&"="&str&"+1"&" where Passed="&Hu_True&" and Del="&Hu_False&" and (id="&SucStr&")"
conn_tupiao.execute sql
'查找成功被投票的单位
set rs=conn_tupiao.execute("Select DanWeiName from DanWei where Passed="&Hu_True&" and Del="&Hu_False&" and (id="&SucStr&")")
if rs.eof then
SucStr=""
else
SucStr=rs(0)
end if
set rs=nothing
end if
if ErrStr<>"" then
set rs=conn_tupiao.execute("Select DanWeiName from DanWei where Passed="&Hu_True&" and Del="&Hu_False&" and (id="&ErrStr&")")
if rs.eof then
Errstr=""
else
ErrStr=rs(0)
end if
set rs=nothing
end if
if SucStr<>"" then
AlertStr="您对“"&SucStr&"”的投票成功\n\n感谢您的参与!"
else
AlertStr="您对“"&Errstr&"”的投票失败\n\n失败原因:投票时间间隔未达到"&JianTime&TimerStr&"!"
end if
end sub
%>