<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp" -->



<%
dim wcdb,rswc,connwc,connwcstr
dim exec,id
wcdb="data/wc_high-score.mdb"
Set rswc = CreateObject("ADODB.Recordset")
set connwc=server.createobject("adodb.connection")
connwcstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(wcdb)

Dim ErrCodes,UserName,ShowUserid
UserName=Dvbbs.membername
If IsNumeric(Request("id")) and Request("id")<>"" Then
	ShowUserid=Clng(Request("id"))
End If

Dvbbs.ActiveOnline

Dvbbs.Loadtemplates("")

Dim plustitle,backasp
plustitle = "休闲室管理"
backasp   = "wc_admin_rec-room.asp"

	dim admin_flag
	admin_flag=",2,"
If Not Dvbbs.master then
		ShowErr()
	Else 
	
select case request("act")
case "ShowErr"
	call ShowErr
case "delallcode"
	call delallcode()
case "modify"
	call modify()
case "modcode"
	call modcode()
case "deletecode"
	call deletecode()
case "addcode"
	call addcode()
case else
	call main()
end select

sub addcode()

dim connwcc,execc,tyype,gamename,gameurl,gameid,gameimg,percentt,award1,award2
set connwcc=server.createobject("adodb.connection")
connwcc.open connwcstr

tyype=request.form("tyype")
gamename=request.form("gamename")
gameurl=request.form("gameurl")
gameid=request.form("gameid")
gameimg=request.form("gameimg")
percentT=request.form("percentT")
award1=request.form("award1")
award2=request.form("award2")

execc="INSERT INTO gamedb (type,gamename,gameurl,gameid,gameimg,percentT,award1,award2)VALUES ("&tyype&",'"&gamename&"','"&gameurl&"','"&gameid&"','"&gameimg&"',"&percentT&","&award1&","&award2&")"
connwcc.execute execc
connwcc.close
set connwcc=nothing
Dvbbs.Stats="添加游戏"
dvbbs.nav()
Dvbbs.head_var 0,0,plustitle,backasp
%>
<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
	<tr>
		<th valign=middle align=center height=25>
		记录添加成功!
		</th>
	</tr>
	<tr>
		<td valign=middle class=tablebody1 align=center>
		<a href="wc_admin_rec-room.asp">返回休闲室管理页</a></td>
	</tr>
</table>
<%
end sub

sub ShowErr
Dvbbs.Stats="错误"
dvbbs.nav()
Dvbbs.head_var 0,0,plustitle,"wc_rec-room.asp"

%>
<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
	<tr>
		<th valign=middle align=center height=25>
		错误！
		</th>
	</tr>
	<tr>
		<td valign=middle class=tablebody1 align=center>本页只有管理员才可使用
		<a href="wc_rec-room.asp">返回休闲室</a></td>
	</tr>
</table>

<%
end sub

sub delallcode()

set connwc=server.createobject("adodb.connection")
connwc.open connwcstr

exec="update gamedb set highscore=0,highname=''"
connwc.execute exec
connwc.close
set connwc=nothing

Dvbbs.Stats="删除游戏"
dvbbs.nav()
Dvbbs.head_var 0,0,plustitle,backasp
%>
<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
	<tr>
		<th valign=middle align=center height=25>
		记录清空成功!
		</th>
	</tr>
	<tr>
		<td valign=middle class=tablebody1 align=center>
		<a href="wc_admin_rec-room.asp">返回休闲室管理页</a></td>
	</tr>
</table>

<%
end sub

sub deletecode()


set connwc=server.createobject("adodb.connection")
connwc.open connwcstr
id=request.form("id")
'exec="delete * from gamedb where id in "&id
exec="delete * from gamedb where id in ("&replace(request("id"),"'","")&")"
connwc.execute exec
connwc.close
set connwc=nothing

Dvbbs.Stats="删除游戏"
dvbbs.nav()
Dvbbs.head_var 0,0,plustitle,backasp
%>
<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
	<tr>
		<th valign=middle align=center height=25>
		记录删除成功!
		</th>
	</tr>
	<tr>
		<td valign=middle class=tablebody1 align=center>
		<a href="wc_admin_rec-room.asp">返回休闲室管理页</a></td>
	</tr>
</table>

<%
end sub

sub modcode()

dim connwcc,execc,tyype,gamename,gameurl,gameid,gameimg,percentt,id,award1,award2


id=request.form("id")
tyype=request.form("tyype")
gamename=request.form("gamename")
gameurl=request.form("gameurl")
gameid=request.form("gameid")
gameimg=request.form("gameimg")
percentT=request.form("percentT")
award1=request.form("award1")
award2=request.form("award2")

set connwcc=server.createobject("adodb.connection")
connwcc.open connwcstr

execc="UPDATE gamedb SET type="&tyype&", gamename='"&gamename&"', gameurl='"&gameurl&"', gameid='"&gameid&"', gameimg='"&gameimg&"', percentT='"&percentT&"', award1="&award1&", award2="&award2&" where id="&id
connwcc.execute execc
connwcc.close
set connwcc=nothing

Dvbbs.Stats="更改设置"
dvbbs.nav()
Dvbbs.head_var 0,0,plustitle,backasp
%>
<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
	<tr>
		<th valign=middle align=center height=25>
		更改设置成功!
		</th>
	</tr>
	<tr>
		<td valign=middle class=tablebody1 align=center>
		<a href="wc_admin_rec-room.asp">返回休闲室管理页</a></td>
	</tr>
</table>
<%
end sub

sub main()
Dvbbs.Stats="管理首页"
dvbbs.nav()
Dvbbs.head_var 0,0,plustitle,backasp
%>

<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
	<tr>
		<th valign=middle align=center height=25>
		<div id="divTitle">
		<b>管理</b> --<a href="wc_rec-room.asp">休闲室</a></div>
		</th>
	</tr>
	<tr>
		<td valign=middle bgcolor=#B898ee align=center height=25>
		<div id="divTitle">
		<b>添加游戏</b></div>
		</td>
	</tr>
	<tr>
		<td valign=middle class=tablebody1>
		<form action=?act=addcode method=post>
		<table border="0" width="100%" id="table2" cellspacing="0" cellpadding="0" height="100%">
			<tr>
				<td>
				<table border="0" width="100%" id="table3" cellspacing="0" cellpadding="0" height="100%">
					<tr>
						<td align="center" width=30%>游戏名：<input name="gamename" border="0" style="background-color: #D2DBE7; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;"  size="20"></td>
						<td align="left">类别：<select name="tyype" style="background-color: #D2DBE7; border: 0 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;"><option selected value=1>冒险</option><option selected value=2>益智</option><option selected value=3>赌博</option></select></td>
						<td align="center" width=50%>游戏文件地址：<input name="gameurl" border="0" style="background-color: #D2DBE7; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;" value="wc_game_.swf" size="30"></td>
					</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
				<table border="0" width="100%" id="table3" cellspacing="0" cellpadding="0" height="100%">
					<tr>
						<td align="center" width=30%>游戏ID：<input name="gameID" border="0" style="background-color: #D2DBE7; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;"  size="20"></td>
						<td align="left">奖金<font color="#A05F5F">千</font>分比：<input name="percentT" maxlength="12" border="0" style="background-color: #D2DBE7; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;"  size="3">‰</td>
						<td align="center" width=50%>游戏图片地址：<input name="gameimg" border="0" style="background-color: #D2DBE7; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;"  size="30"></td>
					</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
				<table border="0" width="100%" id="table4" cellspacing="0" cellpadding="0" height="100%">
					<tr>
						<td align="center">第一名金钱奖励：<input name="award1" border="0" style="background-color: #D2DBE7; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;"  size="20"></td>
						<td align="center" width=50%>第一名魅力奖励：<input name="award2" border="0" style="background-color: #D2DBE7; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;"  size="20"></td>
					</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
				<table border="0" width="100%" id="table3" cellspacing="0" cellpadding="0" height="100%">
					<tr>
						<td align="center">
<input type="submit" name="Submit" value="提交" style="background-color: #EEEEF; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;"></td>
					</tr>
					</table>
				</td>
			</tr>
		</table>
		</form>
		</td>
	</tr>
	<tr>
		<td valign=middle bgcolor=#B898ee align=center height=25>
		<div id="divTitle">
		<b>游戏管理</b></div>
		</td>
	</tr>
	<tr>
		<td bgcolor=#ffffff>
		<form action="?act=deletecode" method=post>
		<table border="0" align=center width="100%" id="table4" cellspacing="0" cellpadding="0">
			<tr align=center>
<%
RSWc.CursorLocation=3 
RSWc.CursorType=3 
RSWc.PageSize="80"

rswc.Source = "SELECT * FROM gamedb ORDER BY id DESC"
rswc.ActiveConnection = connwcstr
rswc.Open()

dim eoff
eoff=0

if rswc.eof then 
eoff = 1
end if

if eoff=0 then 
if Request.QueryString("pg")="" then
rswc.AbsolutePage=1
else
rswc.AbsolutePage=cint(Request.QueryString("pg"))
end if
end if

dim eof,iiii
eof=0

if rswc.eof then 
eof = 1
response.write ("<table width=200><tr><td align=center>没游戏哈！</td></tr></table>")
end if

if eof=0 then
do until rswc.eof or iiii=80
if iiii=4 or iiii=8 or iiii=12 or iiii=16 then response.write "</tr><tr>"
%>

				<td width="25%" align=left>&nbsp;&nbsp;<input type="checkbox" name="id" value="<%=rswc("id")%>">
				<a href="?act=modify&id=<%=rswc("id")%>"><%=rswc("gamename")%></a></td>
<%
iiii = iiii+1
rswc.movenext
loop
end if
rswc.close%>

			</tr>
			<tr>
			<td bgcolor=#ffffff colspan=4>
			<p align="center">
			<input type="submit" name="Submit" value="删除" style="background-color: #EEEEF; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;">
			</td>
			</tr>
		</table>
		</form></td>
	</tr>
	<tr>
		<td valign=middle bgcolor=#B898ee align=center height=25>
		<div id="divTitle">
		<b>数据库管理</b></div>
		</td>
	</tr>
	<tr>
		<td bgcolor=#ffffff>
		<table border="0" align=center width="100%" id="table4" cellspacing="0" cellpadding="0">
			<tr align=center>

				<td height="30"><font style="font-weight: bold;color: #ff0000;"><a href="?act=delallcode" title="仅清空第一名记录，不会删除游戏分数记录">清空游戏第一名记录</a></font></td>


			</tr>
			</table>
		</td>
	</tr>

</table>
<%

end sub

sub modify()

dim id,gtype
id=request.querystring("id")
rswc.Source = "SELECT * FROM gamedb WHERE id="&id&" ORDER BY id DESC"
rswc.ActiveConnection = connwcstr
rswc.Open()

gtype=rswc("type")

Dvbbs.Stats=""&rswc("gamename")&"-游戏设置"
dvbbs.nav()
Dvbbs.head_var 0,0,plustitle,backasp
%>
<form action="?act=modcode" method=post>
<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
	<tr>
		<th valign=middle align=center height=25 colspan="2">
		<div id="divTitle">
		<b><%=rswc("gamename")%>-游戏设置</b> --<a href="wc_admin_rec-room.asp">返回休闲室管理</a></div>
		</th>
	</tr>
	<tr><td bgcolor=#ffffff><table width=80% height=100% border=0 align=center>
	<tr>
		<td width=35% align=right>
		游戏名：&nbsp;&nbsp;&nbsp; </td>
		<td align=left><input value="<%=rswc("gamename")%>" type="text" name="gamename" border="0" style="background-color: #D2DBE7; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;" size="35"></td>
	</tr>
	<tr>
		<td width=35% align=right>
		类别：&nbsp;&nbsp;&nbsp; </td>
		<td align=left>
		<select name="tyype" style="background-color: #D2DBE7; border: 0 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;"><option <%if gtype=1 then response.write "selected"%> value=1>冒险</option><option <%if gtype=2 then response.write "selected"%> value=2>益智</option><option <%if gtype=3 then response.write "selected"%> value=3>赌博</option></select></td>
	</tr>
	<tr>
		<td width=35% align=right>
		游戏地址：&nbsp;&nbsp;&nbsp; </td>
		<td align=left>
		<input value="<%=rswc("gameurl")%>" name="gameurl" border="0" style="background-color: #D2DBE7; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;" value="wc_game_.swf" size="35"></td>
	</tr>
	<tr>
		<td width=35% align=right>
		游戏ID：&nbsp;&nbsp;&nbsp; </td>
		<td align=left>
		<input value="<%=rswc("gameID")%>" name="gameID" border="0" style="background-color: #D2DBE7; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;" size="35"></td>
	</tr>
	<tr>
		<td width=35% align=right>
		游戏比分<font color="#FF0000">千</font>分比：&nbsp;&nbsp;&nbsp; </td>
		<td align=left>
		<input value="<%=rswc("percentt")%>" name="percentT" maxlength="12" border="0" style="background-color: #D2DBE7; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;" size="35"></td>
	</tr>
	<tr>
		<td width=35% align=right>
		游戏图片地址：&nbsp;&nbsp;&nbsp; </td>
		<td align=left>
		<input value="<%=rswc("gameimg")%>" name="gameimg" border="0" style="background-color: #D2DBE7; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;" size="35"></td>
	</tr>
		<tr>
		<td width=35% align=right>
		第一名金币奖励： </td>
		<td align=left>
		<input name="award1" value="<%=rswc("award1")%>" border="0" style="background-color: #D2DBE7; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;" size="35"></td>
	</tr>
		<tr>
		<td width=35% align=right>
		第一名点券奖励：</td>
		<td align=left>
		<input name="award2" value="<%=rswc("award2")%>" border="0" style="background-color: #D2DBE7; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;" size="35"></td>
	</tr>
		<tr>
		<td colspan=2 align=right>
		<p align="center"><input type=hidden name="id" value="<%=rswc("id")%>">
<input type="submit" name="Submit0" value="提交" style="background-color: #EEEEF; border: 1 solid #003366; color: #003366; font-family:Verdana, Arial,宋体; font-size: 9pt;"></td>
	</tr>
	</table></td></tr>
</table></form>
<%
rswc.close
end sub%>
<%end if%><%
Dvbbs.Footer()
%>