<!--#include file="../inc/conn.asp"-->
<%
PollID=cint(Request.QueryString("TitleID"))

sql="SELECT ID,pid,投票类型,选项内容,票数,投票用户,发布日期,发起日期,到期日期 FROM BBS_Poll where ID="&PollID&" or pid="&PollID&" "
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.BOF and rs.EOF then
    Pollwrite="" '没有找到相应的投票项目
else
    rs.MoveFirst
    if rs("投票类型")=1 then
        tptype=1
        tptype1="radio"
    else
        tptype=2
        tptype1="checkbox"
    end if
    Pollwrite=rs("选项内容")
    Pollwrite="<form name=tppoll action=../../bbs/poll.asp?tptype="&tptype&"&pollid="&pollid&" method=post style=MARGIN-BOTTOM: 0px;>"
    rs.MoveNext
    while not rs.EOF
    Pollwrite=Pollwrite+"<input name=tp type="&tptype1&" value="&rs("ID")&">"&rs("选项内容")&"<br>"
    rs.MoveNext
    wend
    sql0="SELECT top 1 ID,发起日期,到期日期 FROM BBS_Poll where pid="&PollID&" and (投票类型=1 or 投票类型=2)"
    Set rs0 = Server.CreateObject("ADODB.Recordset")
    rs0.open sql,conn,1,1
    dt=DateDiff("d",now(),rs0("到期日期"))
    begindate=rs0("发起日期")
    enddate=rs0("到期日期")
    rs0.close
    set rs0=nothing
	dis=""
	if dt<0 then
	dis="disabled"
	end if
    Pollwrite=Pollwrite+"<input type=Submit value=提交 name=okpoll "&dis&">&nbsp;<a href=../../bbs/poll.asp?lookpollid="&pollid&">查看结果</a></form>&nbsp;开始投票 "&begindate&" 结束投票 "&enddate
end if
rs.Close
set rs=nothing
conn.close
Pollwrite="document.write(""" & Pollwrite & """);"
Response.Write Pollwrite
%>