<!--#include file="Admin_check.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<div align="center">
<table border="2" cellpadding="3" cellspacing="0" bordercolor="#999999" bgcolor='#DEF0FE' bordercolordark="#FFFFFF" width="98%">
  <tr bgcolor="#2c68b9">
    <td height="28" align="center">
    <b><font color="#FFFFFF">论坛监狱管理</font></b></td>
  </tr>
  <%select case request("menu")
case""%>
<form action="?menu=lockuser" method="POST">

<tr bgcolor='#DEF0FE'><td><b><font color='#FF0000'>请君入狱</font></b></font></td></tr>
<tr ><td>用户名：<input type="text" name="lockname" size="20"> 罪名：<input type="text" name="zm" size="30"> (不多于50个字）</td></tr>
<tr ></td><td>入狱天数：<input name="locktime" type="text" value="3" size="5"> 罚金：<input name="wealth" type="text" value="1000" size="5"> 游戏币：<input name="mygamecoin" type="text" value="50" size="5">
<input type="submit" value=" 确 定 " name="B1" class="submit">&nbsp;&nbsp;<input type="reset" value=" 重 置 "></td></tr>
</form>
<form action="?menu=unlockuser" method="POST">
<tr>
<td><font color=#FF0000><b>释放出狱</b></font></td></tr><td>用户名：<input type="text" name="unlockname" size="20"> 
<input type="submit" value=" 确 定 " name="B1" class="submit">&nbsp;&nbsp;<input type="reset" value=" 重 置 "></td></tr>
</form>
<%case"lockuser"%><br>

<%dim lockname,zm,locktime,wealth,NewSmsNum,mygamecoin
lockname=Replace(Request.form("lockname"),"'","''")
zm=Replace(Request.form("zm"),"'","''")
locktime=Replace(Request.form("locktime"),"'","''")
wealth=Replace(Request.form("wealth"),"'","''")
mygamecoin=Replace(Request.form("mygamecoin"),"'","''")
if lockname="" or zm="" or locktime="" or wealth="" or mygamecoin="" then%>
<tr>
	<td>&nbsp;<font color='#FF0000'><b>错 误 信 息</b></font></td></tr>
<tr><td><font color=FF0000>不能执行操作,请输入正确的完整信息.</font></td></tr>
<td><a href='javascript:history.back()' title='返回'><b>返回重填</b></a></td>
<%response.end
end if
dim rs1
set rs1=server.createobject("adodb.recordset")
sql="select * from [kk_user] where name='"&lockname&"'"
rs1.open sql,conn,1,3
 if rs1.eof and rs1.bof then
%>
<tr><td>&nbsp;<font color='#FF0000'><b>错 误 信 息</b></font></td></tr>
<tr><td><font color=FF0000>不能执行操作,不存在该用户.</font></td></tr>
<td><a href='javascript:history.back()' title='返回'><b>返回重填</b></a></td>
<%else
dim acd 
  set acd=bbs94kk.execute("select * from [kk_admin] where name='"&lockname&"'")
   if not acd.eof then %>
<tr>
	<td>&nbsp;<font color='#FF0000'><b>错 误 信 息</b></font></td></tr>
<tr><td><font color=FF0000>不能执行操作,该用户为管理员或版主，不能将管理组成员投入监狱.</font></td></tr>
<td><a href='javascript:history.back()' title='返回'><b>返回重填</b></a></td>
<% rs1.close
   set rs1=nothing
   set acd=nothing
   response.end
   end if
rs1("coin")=rs1("coin")-int(wealth)
rs1("gamecoin")=rs1("gamecoin")-int(mygamecoin)
rs1("lock")=true
rs1("zm")=zm
rs1("locktime")=locktime
rs1("zxtime")=date
rs1.update
bbs94kk.ExeCute("INSERT INTO [kk_sms] (myname,name,content) values('"&lockname&"','监狱所长','由于你扰乱论坛秩序，现暂时把你关在监狱里反省反省，自己到监狱里去看看吧。金钱扣除"&wealth&"元,游戏币扣除"&mygamecoin&"枚。')")
BBS94KK.ExeCute("Update [KK_user] Set NewSmsNum=NewSmsNum+1 Where Name='"&lockname&"'")
response.write"<tr><td>&nbsp;<font color='#FF0000'><b>执行成功</b></font></td></tr><tr><td>&nbsp;<font color=FF0000><b>"&lockname&"</b></font>&nbsp;：因 <font color='#FF0000'><b>"&zm&"</b></font>，入狱 <font color=red><b>"&locktime&"</b></font> 天！！！！执行日期：<font color=red><b>"&date&" &nbsp;&nbsp;&nbsp;&nbsp;消息已发送</b></font></td></tr><td><a href='javascript:history.back()' title='返回'><b>返回</B></a></td>"
end if
rs1.close
set rs1=nothing
%>
<%dim rsu,sql,unlockname
case"unlockuser"%>
<%unlockname=Replace(Request.form("unlockname"),"'","''")
set rsu=server.createobject("adodb.recordset")
sql="select lock from [kk_user] where name='"&unlockname&"'"
rsu.open sql,conn,1,3
if rsu.eof and rsu.bof then
response.write"<tr><td>&nbsp;<font color='#FF0000'><b>错 误 信 息</b></font></td></tr><tr><td><font color=FF0000>不能执行操作,不存在该用户.</font></td></tr><td><a href='javascript:history.back()' title='返回'>返回重填</a></td>"
else 
rsu("lock")=false
rsu.update
bbs94kk.ExeCute("INSERT INTO [kk_sms] (myname,name,content) values('"&unlockname&"','监狱所长','由于你在监狱里表现良好，现提前把你放出去，希望你以后不要再扰乱论坛秩序了。')")
BBS94KK.ExeCute("Update [KK_user] Set NewSmsNum=NewSmsNum+1 Where Name='"&unlockname&"'")
response.write"<tr><td><font color=red><b>"&unlockname&"</b></font> <font color=006600><b>释放出狱成功 &nbsp;&nbsp;&nbsp;&nbsp;消息已发送</b></font></td></tr><td><a href='javascript:history.back()' title='返回'><b>返回</B></a></td>"
end if
rsu.close
set rsu=nothing
end select%></table></center></div><br><br>
<div align="center">
<table border="2" cellpadding="0" cellspacing="0" bordercolor="#999999" bgcolor='#DEF0FE' bordercolordark="#FFFFFF" width="98%">
<tr bgcolor="#2c68b9"><td height="28" align="center" colspan="5"><b><font color="#FFFFFF">监狱犯人名单</font></b></td></tr>
<%
Dim leftday
Set Rs=BBS94KK.Execute("select name,zm,zxtime,locktime,lock From [KK_user] where Lock=True")
 If Rs.eof Then
	response.write"<tr align=center><td><font color=blue>本社区治安良好,监狱所长没事干^_^</font></td></tr>"
  Else
	response.write"<tr align=center><td width=15% height=26><font color=#FF0000><b>犯 人</b></td><td width=35% height=26><font color=#FF0000><b>罪 名</b</font></td><td width=15% height=26><font color=#FF0000><b>有期徒刑</b><b>(天)</b></font></td><td width=15% ><font color=#FF0000><b>执行时间</b></font></td><td width=10% ><font color=#FF0000><b>剩余时间</b></font></td></tr>"

 Do While Not rs.eof  
	leftday=datediff("d",cdate(rs("zxtime")),cdate(now()))
	leftday=int(rs("locktime"))-int(leftday)
	If int(leftday)<=0 Then
		bbs94kk.execute("update [kk_user] set lock=False where name='"&rs("name")&"'")
	End if
	response.write"<tr align=center height=25><td width=15% align=center><font color=blue>"&Rs("name")&"</font></td><td  width=35% align=center>"&rs("zm")&"</td><td  width=15% align=center>"&Rs("locktime")&"天</td><td  width=15% align=center>"&rs("zxtime")&"</td><td  width=10% align=center>"&leftday&"天</td></tr>"
	Rs.movenext
	Loop
	End if
   Rs.close
   Set rs=nothing
%></table></div>