<!--#include file="conn.asp"-->
<!--#include file="conntest.asp"-->
<!-- #include file="inc/const.asp" -->
<!-- #include file="chkuser.asp" -->
<!--#include file=inc/theme.asp -->
<!--#include file="inc/char.asp"-->
<%
dim usern,ars,alb,atitle,akey1,akey2,akey3,akey4,aok,ausername,aid,albname,title,incept,message,userw,ars2
dim atx,auserjl,aup
set rs=server.createobject("adodb.recordset")
sql="select username from [admin] where username='"&membername&"'"
rs.open sql,conn,1,1
if not rs.eof then
usern=rs(0)
rs.close
else
rs.close
end if
if membername="" then
response.write "<script>location.href='login.asp'</script>"
elseif usern="" then
response.write "<script>alert('你没有权限执行此操作！')</script>"
response.write "<script>location.href='index.asp'</script>"
else
stats="知识问答"

call nav()
call headline(1)

set ars=server.createobject("adodb.recordset")
sql="select lb,title,key1,key2,key3,key4,ok,username,id,tx from [testtemp]"
ars.open sql,aconn,1,1
if not ars.eof then
alb=ars(0)
atitle=ars(1)
akey1=ars(2)
akey2=ars(3)
akey3=ars(4)
akey4=ars(5)
aok=ars(6)
ausername=ars(7)
aid=ars(8)
atx=ars(9)
ars.close
else
ars.close
end if

if request("b1")="通过审核" then
  call pass()
  elseif request("b1")="删除本题" then
  call nopass()
  else
if alb="" then
response.write "<script>alert('暂时没有上传题目！')</script>"
response.write "<script>location.href='test.asp'</script>"
else
set ars=server.createobject("adodb.recordset")
sql="select lb from [testlb] where id="&alb
ars.open sql,aconn,1,1
albname=ars(0)
ars.close
%>
<body style="text-align: center">

<form method="POST" action="admin_iitest.asp?action=pass">
<table border=0 width="677" align=center cellspacing=1 bgcolor="<%=tablebackcolor%>" height="166">
  <tr bgcolor="<%=tablebodycolor%>">
    <td width="70"  align="center"><font color="#FF0000"><b>题　号</b></font></td>
    <td width="82" >&nbsp;<%=aid%> </td>
    <td width="98"><b><font color="#FF0000">&nbsp;题目所属类别</font></b></td>
    <td width="102">&nbsp;<%=albname%> </td>
    <td width="57" >
    <p align="center"><b><font color="#FF0000"> 
    <span lang="zh-cn">题型　　</span></font></b></td>
    <td width="63" >&nbsp;<%if atx=1 then
    								response.write "填空题"
    								else
    								response.write "选择题"
    								end if%></td>
    <td width="90"><span lang="zh-cn"><font color="#FF0000"><b>
    　本题上传者</b></font></span></td>
    <td width="102">　<%=ausername%></td>
  </tr>
  <tr bgcolor="<%=tabletitlecolor%>">
    <td width="70"  align="center"><font color="#FF0000"><b>题&nbsp;&nbsp;目</b></font></td>
    <td width="600" colspan="8"><%=atitle%></td>
  </tr>
  <tr bgcolor="<%=tablebodycolor%>">
    <td width="70"  align="center">
    <input type="radio" value=1 name="R1" checked></td>
    <td width="600" colspan="8" >&nbsp;<%=akey1%>　</td>
  </tr>
  <tr bgcolor="<%=atablebodycolor%>">
    <td width="70" align="center"><input type="radio" value=2 name="R1"></td>
    <td width="600" colspan="8" >&nbsp;<%=akey2%>　</td>
  </tr>
  <tr bgcolor="<%=tablebodycolor%>">
    <td width="70" align="center"><input type="radio" value=3 name="R1"></td>
    <td width="600" colspan="8" >&nbsp;<%=akey3%>　</td>
  </tr>
  <tr bgcolor="<%=atablebodycolor%>">
    <td width="70"  align="center"><input type="radio" value=4 name="R1"></td>
    <td width="600" colspan="8" >&nbsp;<%=akey4%>　</td>
  </tr>
  <tr bgcolor="<%=atablebodycolor%>">
    <td width="70"  align="center">正确答案</td>
    <td width="81" ><%=aok%>　</td>
    <td width="116" colspan="2" >
    <p align="center"><b><font color="#FF0000"> 
    <span lang="zh-cn">限时</span></font></b>
      <input type="text" name="time1" size="7" value="60"> <b><font color="#FF0000"> 
    <span lang="zh-cn">秒</span></td>
    <td width="172" colspan="2" >
    <p align="center"><b><font color="#FF0000">本题奖金<input type="text" name="jj1" size="7" value="5">元</font></b></td>
    <td width="231" colspan="3" >
    <p align="center"><font color="#0000FF"><b>
    审核通过后不可删除，请慎重！</b></font></td>
  </tr>
</table>
<p align="center">
<input type="submit" value="通过审核" name="B1">　　<input type="submit" value="删除本题" name="B1">
</font></p>
</p>    </form>


<%
end if
end if
end if

sub pass()

set ars2=server.createobject("adodb.recordset")
sql="select lb,jj,time,title,key1,key2,key3,key4,ok,tx from [test] where lb="&alb
ars2.open sql,aconn,1,3


ars2.addnew
ars2(0)=alb
ars2(1)=request("jj1")
ars2(2)=request("time1")
ars2(3)=atitle
ars2(4)=akey1
ars2(5)=akey2
ars2(6)=akey3
ars2(7)=akey4
ars2(8)=aok
ars2(9)=atx
ars2.update
ars2.close

sql="delete from [testtemp] where id="&aid
aconn.execute sql

set rs=server.createobject("adodb.recordset")
sql="select userwealth from [user] where username='"&ausername&"'"
rs.open sql,conn,1,1
userw=rs(0)
rs.close

set ars=server.createobject("adodb.recordset")
sql="select userjl from [config]"
ars.open sql,aconn,1,1
auserjl=ars(0)
ars.close

conn.execute ("update [user] set userWealth='"&userw+auserjl&"' where username='"&ausername&"'")

set ars=server.createobject("adodb.recordset")
sql="select userpass from [testuser] where username='"&ausername&"'"
ars.open sql,aconn,1,1
aup=ars(0)
aconn.execute ("update testuser set userpass='"&aup+1&"' where username='"&ausername&"'")
ars.close

title="加入知识问答题目成功！"
message="你录入的知识问答题目　　"&atitle&"   已通过审核，同时，奖励给你的"&auserjl&"元社区元也已加入你的现金帐户，请查收！"
incept=ausername

sql="insert into message (incept,sender,title,content,sendtime,flag,issend) values ('"&incept&"','"&membername&"','"&title&"','"&message&"',Now(),0,1)"
conn.execute sql

response.write "<script>alert('审核完成！')</script>"

response.write "<script>location.href='admin_iitest.asp'</script>"

end sub

sub nopass
sql="delete from [testtemp] where id="&aid
aconn.execute sql

title="知识问答题目删除通知！"
message="你录入的知识问答题目　　"&atitle&"   没有通过审核，已从临时库中删除，请注意！"
incept=ausername

sql="insert into message (incept,sender,title,content,sendtime,flag,issend) values ('"&incept&"','"&membername&"','"&title&"','"&message&"',Now(),0,1)"
conn.execute sql

response.write "<script>alert('审核完成！')</script>"

response.write "<script>location.href='admin_iitest.asp'</script>"

end sub

call endline()
%><!--#include file="footer.asp"-->