<!--#include file="inc_const.asp"-->
<%response.expires=0
Response.CacheControl = "Private"
application.lock

set cschat=server.createobject("ffcschat.cssbchat")
my_level=cschat.getLevel(Session,Application(ConstStr & "_user_list"),Application(ConstStr & "_room_list"))

application.unlock
if my_level-application( ConstStr & "_superlevel")<>0 then
  set cschat=nothing
  response.end
end if

Set Conn=Server.CreateObject("ADODB.Connection")
conn.open "DBQ="+server.mappath("questions.asp")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"

ID=request("ID")
if ID<>"" then
  sql="select * from questlib where ID="&ID
  set rs=conn.Execute(sql)
  if rs.eof or rs.bof then ID=""
end if
if request("cmdYes")="确认" then
  cschat.FilterStr = Application(ConstStr & "_saysfilterstr")
  stype=cschat.trdb(left(request("stype"),10))
  squestion=cschat.trdb(left(request("squestion"),100))
  sanswer=cschat.trdb(left(request("sanswer"),50))
  addexp=cint(request("addexp"))
  if sanswer="" or squestion="" or stype="" then
    errtext="<font color=green>错误</font>：分类、提问、答案不能为空！"
  elseif id<>"" then
    sql="update questlib set stype='"&stype&"',squestion='"&squestion&"',sanswer='"&sanswer&"',addexp="&addexp&" where id="&id
    conn.Execute(sql)
    errText="<font color=green>操作成功</font>：你成功地修改了答题内容！"
  else
    sql="insert into questlib (stype,squestion,sanswer,addexp) values ('"&stype&"','"&squestion&"','"&sanswer&"',"&addexp&")"
    conn.Execute(sql)
    errText="<font color=green>操作成功</font>：你成功地添加了新的答题！"
    Application( ConstStr & "_quest_num")=Application( ConstStr & "_quest_num")+1
  end if
  response.redirect("showerr.asp?errtext="&errtext)
else%>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="chat.css">
<style>u{color:red}</style>
<body style="background-color:EAF2FF;color:112233;scrollbar-Base-Color: #b0d8ff;SCROLLBAR-DARKSHADOW-COLOR:#b0d8ff;SCROLLBAR-arrow-COLOR:#336699;SCROLLBAR-TRACK-COLOR: EAF2FF;SCROLLBAR-3DLIGHT-COLOR: #b0d8ff;SCROLLBAR-SHADOW-COLOR: #336699;SCROLLBAR-HIGHLIGHT-COLOR: #b0d8ff;" leftmargin=3 topmargin=20 >
  <table width=400 align=center cellspacing=0 cellpadding=0 border=1 BORDERCOLORLIGHT=#000000 BORDERCOLORDARK=#ffffff>
  <tr><td class=navy1>修改或添加答题库</td></tr>
 <form action="questionmod.asp" method="post">
 <input type=hidden name="id" value="<%=id%>">
 <tr><td height=100 style="text-align:left">分类:<input type="text" name="stype" maxlength="10" size="10" value="<%if ID<>"" then%><%=rs("stype")%><%else%>字谜<%END IF%>"><font color=990000>[最好是两个汉字]</font>
 <br>提问:<input type="text" name="squestion" maxlength="100" size="40" value="<%if ID<>"" then%><%=rs("squestion")%><%END IF%>">
 <br>答案:<input type="text" name="sanswer" maxlength="50" size="40" value="<%if ID<>"" then%><%=rs("sanswer")%><%END IF%>">
 <br>奖励:<input type="text" name="addexp" maxlength="10" size="10" value="<%if ID<>"" then%><%=rs("addexp")%><%else%>5<%END IF%>"><font color=990000>[奖励为经验值。所有项目必填]</font>
  <tr><td height=40><input class=navy1 type="submit" name="cmdYes" value="确认" >
    <input class=navy1 type="reset" name="cmdClear" value="清除" onclick="javascript:document.froms[0].stype.focus();return true">
    </td></tr></form><tr><td style=text-align:left ><a href="" onclick="var a=prompt('您要对所有的奖励值做什么操作？','00');if (a) window.open('qaddexpmod.asp?addexp='+a,'_self');return false;" >经验值奖励修改</a>：对经验值奖励进行全部修改。可以输入“<u>5</u>”--将所有答题的奖励修改为5；可以输入“<u>05</u>”--所有答题的奖励值加上5；可以输入“<u>-5</u>”--所有答题的奖励值减去5。</td></tr></table><tr<td><br><center>[<a href='javascript:history.go(-1)'>后退</a>]</table></body></html>
<%end if
set cschat=nothing
conn.close
set conn=nothing%>











