<!--#include file="Admin_Check.asp"-->
<%
'================================
'当前版本号：3.0
'程序作者：杜杜
'杜杜 版权所有
'Http://vvbbs.3126.com
'================================
Head()
ID=request.querystring("ID")
If ID="" Then ID=0
dim wcdb,rswc,connwc,connwcstr
dim exec,id
wcdb="wc_game/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=BBS94KK.membername
If IsNumeric(Request("id")) and Request("id")<>"" Then
	ShowUserid=Clng(Request("id"))
End If
Dim plustitle,backasp
plustitle = "猪婷家园管理"
backasp   = "wc_admin_rec-room.asp"
dim admin_flag
admin_flag=",2,"	
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
BBS94KK.Stats="添加游戏"
%>
<table width="98%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF" bgcolor="#DEF0FE">
	<tr bgcolor="#D7DAEA">
		<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
BBS94KK.Stats="错误"
%>
<table width="98%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF" bgcolor="#DEF0FE">
	<tr>
		<th valign=middle align=center height=25>
		错误！
		</th>
	</tr>
	<tr>
		<td valign=middle align=center>本页只有管理员才可使用
		<a href="wc_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
BBS94KK.Stats="删除游戏第一名纪录"
%>
<table width="98%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF" bgcolor="#DEF0FE">
	<tr bgcolor="#D7DAEA">
		<th valign=middle align=center height=25>
		记录清空成功!
		</th>
	</tr>
	<tr>
		<td valign=middle 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
BBS94KK.Stats="删除游戏"
%>
<table width="98%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF" bgcolor="#DEF0FE">
	<tr bgcolor="#D7DAEA">
		<th valign=middle align=center height=25>
		记录删除成功!
		</th>
	</tr>
	<tr>
		<td valign=middle 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
BBS94KK.Stats="更改设置"
%>
<table width="98%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF" bgcolor="#DEF0FE">
	<tr bgcolor="#D7DAEA">
		<th valign=middle align=center height=25>
		更改设置成功!
		</th>
	</tr>
	<tr>
		<td valign=middle align=center>
		<a href="wc_admin_rec-room.asp">返回猪婷家园管理页</a></td>
	</tr>
</table>
<%
end sub

sub main()
BBS94KK.Stats="猪婷家园管理"
%>
<table width="98%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF" bgcolor="#DEF0FE">
	<tr  bgcolor="#4D65A4">
		<th valign=middle align=center height=25>
		<font color="#FFFFFF">猪婷家园管理 ( 请不要提交空内容，否则会出错 )</font>
		</th>
	</tr>
	<tr bgcolor="#D7DAEA">
		<td valign=middle align=center height=25>
		<b>添 加 游 戏</b>
		</td>
	</tr>
	<tr>
		<td valign=middle>
		<form action=?act=addcode method=post>
		<table width="100%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF" bgcolor="#DEF0FE">
		  <tr>
				<td align="right">游戏名：</td>
				<td align="left"><input name="gamename" size="20"></td>
				<td align="right">游戏文件地址：</td>
				<td align="left"><input name="gameurl" value="wc_game/.swf" size="30"></td>
			</tr>
			<tr>
				<td align="right">游戏ID：</td>
				<td align="left"><input name="gameID" size="20"></td>
				<td align="right">游戏图片地址：</td>
				<td align="left"><input name="gameimg" value="wc_game/pics/" size="30"></td>
			</tr>
			<tr>
				<td align="right">类别：</td>
				<td align="left"><select name="tyype" ><option selected value=1>冒险</option><option value=2>益智</option><option value=3>赌博</option></select></td>
				<td align="right">奖金<font color="red">千</font>分比：</td>		
				<td align="left"><input name="percentT" maxlength="12" value="1" size="3">‰</td>										
			</tr>
			<tr>
				<td align="right">第一名金钱奖励：</td>
				<td align="left"><input name="award1" value="100" size="20"></td>
				<td align="right">第一名游戏币奖励：</td>
				<td align="left"><input name="award2" value="100" size="30"></td>
			</tr>
			<tr bgcolor="#E8F4EF">
				<td align="center" colspan="4"><input type="submit" name="Submit" value="添加"></td>
		  </tr>
	  </table>
		</form>
		</td>
	</tr>
	<tr bgcolor="#D7DAEA">
		<td valign=middle align=center height=25>
		<b>游 戏 管 理</b>
		</td>
	</tr>
	<tr>
		<td>
		<form action="?act=deletecode" method=post>
		<table width="100%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF" bgcolor="#DEF0FE">
			<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 bgcolor="#E8F4EF">
			  <td colspan=4 align="center"><input type="submit" name="Submit" value="删除"></td>
			</tr>
		</table>
		</form></td>
	</tr>
	<tr bgcolor="#D7DAEA">
		<td valign=middle align=center height=25>
		<b>数据库管理</b>
		</td>
	</tr>
	<tr>
		<td>
		<table width="100%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF" bgcolor="#DEF0FE">
			<tr align=center>
				<td height="30"><a href="?act=delallcode" title="仅清空第一名记录，不会删除游戏分数记录"><b>清空游戏第一名记录</b></a></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")
BBS94KK.Stats=""&rswc("gamename")&"-游戏设置"
%>
<form action="?act=modcode" method=post>
<table width="98%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF" bgcolor="#DEF0FE">
	<tr bgcolor="#D7DAEA">
		<th valign=middle align=center height=25 colspan="2">
		<b><%=rswc("gamename")%>-游戏设置</b> --<a href="wc_admin_rec-room.asp">返回休闲屋管理</a>
		</th>
	</tr>
	<tr><td>
		<table width="98%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF" bgcolor="#DEF0FE">
	<tr>
		<td width=35% align=right>
		游戏名：</td>
		<td align=left><input value="<%=rswc("gamename")%>" type="text" name="gamename" size="35"></td>
	</tr>
	<tr>
		<td width=35% align=right>
		类别：</td>
		<td align=left>
		<select name="tyype"><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>
		游戏地址：</td>
		<td align=left>
		<input value="<%=rswc("gameurl")%>" name="gameurl" value="wc_game_.swf" size="35"></td>
	</tr>
	<tr>
		<td width=35% align=right>
		游戏ID：</td>
		<td align=left>
		<input value="<%=rswc("gameID")%>" name="gameID" size="35"></td>
	</tr>
	<tr>
		<td width=35% align=right>
		游戏比分<font color="#FF0000">千</font>分比：</td>
		<td align=left>
		<input value="<%=rswc("percentt")%>" name="percentT" maxlength="12" size="35">‰</td>
	</tr>
	<tr>
		<td width=35% align=right>
		游戏图片地址：</td>
		<td align=left>
		<input value="<%=rswc("gameimg")%>" name="gameimg" size="35"></td>
	</tr>
		<tr>
		<td width=35% align=right>
		第一名金币奖励： </td>
		<td align=left>
		<input name="award1" value="<%=rswc("award1")%>" size="35"></td>
	</tr>
		<tr>
		<td width=35% align=right>
		第一名点券奖励：</td>
		<td align=left>
		<input name="award2" value="<%=rswc("award2")%>" 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="提交"></td>
	</tr>
	</table></td></tr>
</table></form>
<%
rswc.close
end sub%>
<%
Footer()
%>