<%Response.Buffer=true response.expires=0 function cn(n,min,max,d) if IsNumeric(n) then if n-min>=0 and n-max<=0 then cn=n else cn=d end if else cn=d end if end function myid=Session("myid") myname=Session("myname") if myid="" or myname="" then response.end application.lock call get_guests if myname<>guests(myid,0) or Session("mytemp")<>guests(myid,1) then response.end my_level=guests(myid,4) set rsparam=conn.execute("select * from param") if guests(myid,4)=rsparam("superlevel") then myname="聊天室管理员" if my_level-rsparam("lvote")<0 then call echoerr("你无权产生投票事件!","tpxt.asp") response.end end if sub prhead(ttl)%>
<%end sub errstr="" if request("B1")="" then call prhead("产生投票事件")%>

事件名称:

选项个数:(2<=选项个数<=30)

自动结束:(0<=天数<=30)

经 验 值:(2<=经验值<=5000)
     自动结束如果为0就为非自动结束
     否则为多少天后投票事件自动结束。
     经验值为具有投票资格的最小经验值
     如果小于10,则为具有投票资格的级别。

<%else votename=trdb(request("votename")) op_num=request("op_num") exp_num=request("exp_num") voteday=cn(request("voteday"),0,30,0) set rs=conn.execute("select * from vote where votename='"&votename&"' and exp_num>1") if votename="" then errstr="投票事件名称不能为空!" elseif not (rs.bof or rs.eof) then errstr="已经存在相同名字的投票事件!" elseif not (isnumeric(op_num) and isnumeric(exp_num)) then errstr="选项个数和经验值必须是数字!" else if op_num-2<0 or op_num-30>0 then errstr="选项个数必须是2~30之间的数字!" elseif exp_num-2<0 or exp_num-5000>0 then errstr="选项个数必须是2~5000之间的数字!" elseif request("B1")="提交" then op_num=int(op_num) exp_num=int(exp_num) call prhead("产生投票事件"&votename)%>

事件名称:<%=votename%>

选项个数:<%=op_num%>

自动结束:<%=voteday%>

经 验 值:<%=exp_num%>

请详细填写各选项的内容:

<%for i=1 to op_num%>

选项<%=i%>:

<%next%>

<%else dim options redim options(op_num-1) for i=1 to op_num options(i-1)=request("options"&i) next for i=0 to op_num-1 if errstr<>"" then exit for if options(i)="" or options(i)=votename then errstr="选项名不能和投票事件一样,也不允许为空!" else for j=0 to op_num-1 if j<>i and options(i)=options(j) then errstr="选项["&i&"]和选项["&j&"]一样!" end if next end if next if errstr="" then sql="INSERT INTO vote (votename,voteoptions,exp_num,begin_time,end_flag) VALUES ('"&votename&"','"&votename&"',"&exp_num&",'"&now()&"','"&dateAdd("d",voteday,now())&"')" conn.Execute(sql) for i=0 to op_num-1 sql="INSERT INTO vote (votename,voteoptions,exp_num) VALUES ('"&votename&"','"&options(i)&"',1)" conn.Execute(sql) next conn.Execute("INSERT INTO record (occ_env,occ_time,for_what) VALUES ('"&myname&" 产生了投票事件 《"&votename&"》 !','"&now()&"','需要吗?不需要吧!')") errstr="你成功地产生了投票事件"&votename&"!" end if end if end if end if if errstr<>"" then call echoerr(errstr,"tpxt.asp") response.end end if application.unlock%>

[后退]