<!--#include File="Config.asp"-->
<%
TypeID = Wed_Lot_ID
Tel = Trim(Request.QueryString("tel"))
if Tel<>"" then 'len(Tel)=11

set rs3=conn.execute("Select max(st3) From [eims_Lottery] where ItemRec=1 and TypeID="&TypeID&" ")
st3=rs3(0)+1 '抽奖顺序

	Set Rs = Server.CreateObject("ADODB.Recordset")
	Sql = "Select Tel,st1,st2,st3 From [eims_Lottery] where ItemRec=1 and TypeID="&TypeID&" and Tel='"&Tel&"' and st1=0 and st2=0"
	Rs.Open Sql,Conn,1,3
		if not rs.eof then
		Rs("st1")=1
		Rs("st2")=1
		Rs("st3")=st3
		Rs.update
		end if
end if

telstr="中奖名单："
Set Rs = Server.CreateObject("ADODB.Recordset")
Sql = "Select Tel,st1,st2 From [eims_Lottery] where ItemRec=1 and TypeID="&TypeID&" and st1=1 and st2=1 and st3>1 order by st3"
Rs.Open Sql,Conn,1,1
while not rs.eof
if trim(rs("tel"))<>"" then
telstr=telstr&"<br>"&trim(rs("tel"))
end if
rs.movenext
wend
response.write telstr

response.write "{$}"

tel2="未中奖名单2"
Set Rs = Server.CreateObject("ADODB.Recordset")
Sql = "Select Tel,st1,st2 From [eims_Lottery] where ItemRec=1 and TypeID="&TypeID&" and st1=0 and st2=0 order by ItemID desc"
Rs.Open Sql,Conn,1,1
while not rs.eof
if trim(rs("tel"))<>"" then
tel2=tel2&"|"&trim(rs("tel"))
end if
rs.movenext
wend
response.write tel2

Call CloseConn()
%>