<!-- #include file=../../inc/BBSsetup.asp -->
<!-- #include file=../../inc/Board_Popfun.asp -->
<!-- #include file=xzconn.asp -->

<%
Response.Buffer=True

DEF_BBS_HomeUrl = "../../"
const npage = 2

GBL_CHK_TempStr=""
OpenDatabase
CheckUserOnline

dim rs,nm
	Dim Temp
	If GBL_SiteHeadString = "" and GBL_SiteBottomString = "" Then
		'针对多个版面不同风格需求 Temp = Left(Request.Cookies(DEF_MasterCookies & "style")("border" & GBL_board_ID),14)
		Temp = Left(Request.Cookies(DEF_MasterCookies & "style")("border"),14)
		If isNumeric(Temp) = 0 or Temp="" Then Temp = -1
		Temp = cCur(Temp)
		If Temp >= 0 and Temp <= DEF_BoardStyleStringNum Then GBL_Board_BoardStyle = Temp
	End If

	If GBL_Board_BoardStyle > DEF_BoardStyleStringNum Then GBL_Board_BoardStyle = DEF_BoardStyleStringNum
	GBL_Board_BoardStyle = cCur(GBL_Board_BoardStyle)

	Temp = application(DEF_MasterCookies & "Style" & GBL_Board_BoardStyle)
	If isArray(Temp) = False Then
		If Temp & "" <> "yes" Then
			If GBL_ConFlag = 1 Then ReloadBoardStyleInfo(GBL_Board_BoardStyle)
			Temp = application(DEF_MasterCookies & "Style" & GBL_Board_BoardStyle)
		End If
	End If
	If isArray(Temp) = True Then
		DEF_BBS_ScreenWidth = RTrim(Temp(1,0))
		DEF_BBS_DisplayTopicLength = Temp(2,0)
		GBL_DefineImage = Temp(3,0)
		If GBL_DefineImage = True or GBL_DefineImage = 1 Then
			GBL_DefineImage = "Skin/" & GBL_Board_BoardStyle & "/"
		Else
			GBL_DefineImage = ""
		End If
		If GBL_SiteHeadString = "" Then GBL_SiteHeadString = Temp(4,0)
		If GBL_SiteBottomString = "" Then GBL_SiteBottomString = Temp(5,0)
		GBL_TableHeadString = Temp(6,0)
		GBL_TableBottomString = Temp(7,0)
		GBL_ShowBottomSure = Temp(8,0)
		GBL_TempletID = cCur("0" & Temp(9,0))
		GBL_TempletFlag = cCur("0" & Temp(10,0))
	End If

%>
<html>
<head>
	<meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb2312">
	<meta http-equiv="Content-Language" content="zh-cn">
	<META name="description" content="无翼天空">
	<title>
	</title>
	<link rel="stylesheet" type="text/css" href="<%=DEF_BBS_homeUrl%>inc/style<%=GBL_Board_BoardStyle%>.css">
	<style>
	<!--
		.l {FONT-FAMILY: 宋体; FONT-SIZE: 12px;}
		table {WORD-BREAK: break-all;}
	-->
	</style>
</head>
<body bgcolor="<%=DEF_BBS_LightestColor%>" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" class=TBBGbody>
<%
	
	if not CheckSupervisorUserName = 1 then
		response.write "<CENTER><table width="&DEF_BBS_ScreenWidth&" border='0' cellspacing='1' cellpadding='4' class=TBone ><tr><td width= 100% valign=center align=middle height=27 class=TBHead><font color=red><b>本页面为管理员使用，您无权访问此页面！</b></font></td></tr></table></CENTER>"
	
	else

	if request("action")="fix" Then
	Call Fixuser()
	End If

	
		if request("action")="save" then
		call savegrade()
		elseif request("action")="add" then
		call add()
		elseif request("action")="savenew" then
		call savenew()
		elseif request("action")="del" then
		call del()
		elseif request("action")="xzpass" then
		call xzpass()
		elseif request("action")="xzpasssave" then
		call xzpasssave()
		else
		call gradeinfo()
		end if
		xzconn.close
		set xzconn=nothing
	end if
sub xzpasssave()
        dim rsa,rsasql,jifen,fatie,meili,jingyan,dengji
		jifen=trim(request.form("jifen"))
		fatie=trim(request.form("fatie"))
		meili=trim(request.form("meili"))
		jingyan=trim(request.form("jingyan"))
		dengji=trim(request.form("dengji"))
        Set Rsa=Server.CreateObject("ADODB.RecordSet")
			rsasql="select * from xzpass"
	    Rsa.Open rsaSQL,xzConn,1,3
		rsa("jifen")=jifen
		rsa("fatie")=fatie
		rsa("meili")=meili
		rsa("jingyan")=jingyan
		rsa("dengji")=dengji
		rsa.update
		rsa.close
		set rsa=nothing
%>
<SCRIPT language=JavaScript>
alert('修改成功!');
this.location.href='xzmanager_admin.asp?action=xzpass';
</SCRIPT>
<%
end sub
sub xzpass()
%>
<table width="100%" border="0" cellspacing="1" cellpadding="3"  align=center class=TBone>
<form method="POST" action=xzmanager_admin.asp?action=xzpasssave>
<tr> 
<td height="23" colspan="4" valign=center class=TBHead><a href=xzmanager_admin.asp><font class=HeadFont><b>勋章管理器</b></font></a>&nbsp;<font class=HeadFont>申请勋章要求设定</font>&nbsp; [<a href="?action=add"><font class=HeadFont><b>添加奖项</b></font></a>]</td> 
</tr>
<tr class=tbbg9> 
<%
dim rsa,rsasql,jifen,fatie,meili,jingyan,dengji
Set Rsa=Server.CreateObject("ADODB.RecordSet")
			rsasql="select * from xzpass"
	Rsa.Open rsaSQL,xzConn,1,1
	jifen=rsa("jifen")
	fatie=rsa("fatie")
	meili=rsa("meili")
	jingyan=rsa("jingyan")
	dengji=rsa("dengji")
	rsa.close
set rsa=nothing
%>
<td class=forumHeaderBackgroundAlternate width="20%" align=right><b>所需<%=DEF_PointsName%>：</b></td>
<td class=forumHeaderBackgroundAlternate width="30%" align=left><input name="jifen" type="text" value="<%=jifen%>" size="15" maxlength="10"></td>
<td class=forumHeaderBackgroundAlternate width="20%" align=right><b>所需发贴：</b></td>
<td class=forumHeaderBackgroundAlternate width="30%" align=left><input name="fatie" type="text" value="<%=fatie%>" size="15" maxlength="10"></td>
</tr>
<tr class=tbbg9> 
<td class=forumHeaderBackgroundAlternate width="20%" align=right><b>所需魅力：</b></td>
<td class=forumHeaderBackgroundAlternate width="30%" align=left><input name="meili" type="text" value="<%=meili%>" size="15" maxlength="10"></td>
<td class=forumHeaderBackgroundAlternate width="20%" align=right><b>所需经验：</b></td>
<td class=forumHeaderBackgroundAlternate width="30%" align=left><input name="jingyan" type="text" value="<%=jingyan%>" size="15" maxlength="10"></td>
</tr>
<tr class=tbbg9> 
<td class=forumHeaderBackgroundAlternate width="20%" align=right><b>所需等级：</b></td>
<td class=forumHeaderBackgroundAlternate width="30%" align=left><input name="dengji" type="text" value="<%=dengji%>" size="15" maxlength="10"></td>
<td class=forumHeaderBackgroundAlternate width="20%" align=right></td>
<td class=forumHeaderBackgroundAlternate width="30%" align=left></td>
</tr>
<tr class=tbbg9>
<td height="23" colspan="4" align=center class=forumHeaderBackgroundAlternate><input type="submit" name="Submit" value="确  定" class=fmbtn></td>
</tr>
</form>
</table>
<%
end sub
sub gradeinfo()
%>
<table width="100%" border="0" cellspacing="1" cellpadding="3"  align=center class=TBone>
<form method="POST" action=xzmanager_admin.asp?action=save>
<tr> 
<td height="23" colspan="6" valign=center class=TBHead><font class=HeadFont>勋章管理器</font>&nbsp;<a href=?action=xzpass><font class=HeadFont><b>申请勋章要求设定</b></font></a>&nbsp; [<a href="?action=add"><font class=HeadFont><b>添加奖项</b></font></a>]</td> 
</tr>
<tr class=tbbg9> 
<td width=10% class=forumHeaderBackgroundAlternate><b>编号</b></td>
<td width=15% class=forumHeaderBackgroundAlternate><b>奖项名称</b></td>
<td width=35% class=forumHeaderBackgroundAlternate><b>相关说明</b></td>
<td width=15% class=forumHeaderBackgroundAlternate><b>图片名</b></td>
<td width=10% class=forumHeaderBackgroundAlternate><b>图片演示</b></td>
<td width=15% class=forumHeaderBackgroundAlternate><B>操作</B></td>
</tr>
<%
dim rs,sql
Set Rs=Server.CreateObject("ADODB.RecordSet")
			sql="select * from xzdata"
	Rs.Open SQL,xzConn,1,1
	if rs.eof then%>
        <tr><td align=center colspan=6 class=tbbg9>暂时没有记录</td></tr>
	<%else
       '分页代码开始
	dim pagecount,fen,count,totalpage
	   fen=8'设置每页要显示的记录条数
       Count=RS.RecordCount
       If Count/fen > (Count\fen) then
       TotalPage=(Count\fen)+1 
       else 
	   TotalPage=(Count\fen)
       End If

       PageCount= 0
       RS.MoveFirst
       if Request("Page")<>"" then PageCount = cint(Request("Page"))
       if PageCount <1 then PageCount = 1
       if PageCount > TotalPage then PageCount = TotalPage
	   RS.Move (PageCount-1) * fen
       '分页代码结束

nm=0
do while not rs.eof and nm<fen
%>
<tr class=tbbg9> 
<td width="70" class=Forumrow>
<input type=hidden value="<%=nm%>" name="xzcount">
<p align="center">
<input size=3 value="<%=rs("xzid")%>" name="xzid" type=text></td>
<td width="131" class=Forumrow>
<input size=17 value="<%=rs("xzname")%>" name="xzname" type=text></td>
<td width="327" class=Forumrow>
<input size=53 value="<%=rs("xzsm")%>" name="xzsm" type=text></td>
<td width="162" class=Forumrow>
<input size=21 value="<%=rs("xzpicurl")%>" name="xzpicurl" type=text></td>
<td width="112" class=Forumrow>
<img src=pic/<%=rs("xzpicurl")%>>　
</td>
<td width="107" class=Forumrow>
<a href="?action=del&xzid=<%=rs("xzid")%>">删除</a></td>
</tr>
<%
nm=nm+1
rs.movenext
loop
rs.close
set rs=nothing
%>
<tr> 
<td width="944" colspan=6 class=tbbg9> 
<input type="submit" name="Submit" value="提 交">
</td>
</tr>
</form>
<tr>
    <td colspan=6 class=tbbg9><%if pagecount=1 then%><font color=darkgray>首页&nbsp;上一页</font><%else%><a href=xzmanager_admin.asp?page=1>首页</a>&nbsp;
			<a href=xzmanager_admin.asp?page=<%=pagecount-1%>>上一页</a><%end if%>&nbsp;
			<%if pagecount=totalpage then%><font color=darkgray>下一页&nbsp;尾页</font><%else%><a href=xzmanager_admin.asp?page=<%=pagecount+1%>>下一页</a>&nbsp;
			<a href=xzmanager_admin.asp?page=<%=TotalPage%>>尾页</a><%end if%>&nbsp;
			&nbsp;共&nbsp;<b><%=Count%></b>&nbsp;条信息&nbsp;&nbsp;第&nbsp;<b><%=PageCount%></b>/<b><%=TotalPage%></b>&nbsp;页&nbsp;&nbsp;每页<b><%=fen%></b>条</td>
</tr><%end if%>
</table>

<%
end sub
sub savegrade()
	Server.ScriptTimeout=99999999
	dim xzname,xzpicurl,xzsm,xzid,i
	
	for i=1 to request.form("xzcount").count
	xzname=request.form("xzname")(i)
	xzpicurl=request.form("xzpicurl")(i)
	xzsm=request.form("xzsm")(i)
	xzid=request.form("xzid")(i)
	if isnumeric(xzid) and xzname<>"" and xzpicurl<>"" and xzsm<>"" then
	xzconn.execute("update xzdata set xzname='"&xzname&"',xzpicurl='"&xzpicurl&"',xzsm='"&xzsm&"' where xzid="&xzid)
	end if
	next
	response.write "勋章设置修改成功，请返回。"
	set rs=nothing
end sub
sub add()
%>
<form name="form1" method="POST" action=xzmanager_admin.asp?action=savenew  onSubmit="return checkdata();">
<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse"  width="95%" id="AutoNumber2" height="46">
    <tr>
      <td width="100%" height="54">
    <p style="margin-top: 0; margin-bottom: 0"><b>注意</b>：<br>
    ①、请保证[<b><font color="#FF0000">勋章ID</font></b>]与[<b><font color="#FF0000">勋章图片</font></b>]的一致性。<br>
    ②、请完整填写所有数据，然后进行保存。</p>
      </td>
    </tr>
  </table>
  </center>
</div>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder" height="93">
<tr> 
<th colspan="2" height="12">添加新的奖项</th>
</tr>
<tr> 
<td width="40%" class=forumrow height="20"><b>勋章名称</b></td>
<td width="60%" class=forumrow height="20">
<input size=30 name="xzname" type=text></td>
</tr>
<tr>
<td width="40%" class=forumrow height="19"><b>勋章说明</b></td>
<td width="60%" class=forumrow height="19">
<input size=30 name="xzsm" type=text></td>
</tr>
<tr>
<td width="40%" class=forumrow height="10"><b>勋章图片</b></td>
<td width="60%" class=forumrow height="10">
<input size=30 name="xzpicurl" type=text></td>
</tr>
<tr>
<td width="100%" class=forumrow height="10" colspan="2"> 
<input type="submit" name="Submit" value="提 交"> </td>
</tr>
</table>
</form>
<script language="JavaScript">
<!--
function checkdata() {
if( form1.xzname.value =="") {
alert("\请输入勋章名称 !!")
 form1.xzname.focus();
return false;
}
if( form1.xzsm.value =="") {
alert("\请输入勋章说明 !!")
 form1.xzsm.focus();
return false;
}
if( form1.xzpicurl.value =="") {
alert("\请输入勋章图片 !!")
 form1.xzpicurl.focus();
return false;
}
return true;
}
function isNumberString (InString,RefString)
{
if(InString.length==0) return (false);
for (Count=0; Count < InString.length; Count++)  {
	TempChar= InString.substring (Count, Count+1);
	if (RefString.indexOf (TempChar, 0)==-1)  
	return (false);
}
return (true);
}

// -->
</script>

<%
end sub
sub savenew()
dim sql
set rs = server.CreateObject ("Adodb.recordset")
sql="select * from xzdata where xzname='"&request.form("xzname")&"'"
rs.open sql,xzconn,1,3
if rs.eof and rs.bof then
rs.addnew
rs("xzname")=request("xzname")
rs("xzsm")=request("xzsm")
rs("xzpicurl")=request("xzpicurl")
rs.update
else
	Errmsg="<br><li>该奖项已存在！"
	call dvbbs_error()
	exit sub
end if
rs.close
set rs=nothing
response.write "该勋章已被成功添加！建议您到勋章管理器中进行属性操作！"
end sub
sub del()
Server.ScriptTimeout=99999999
dim xzid
if isnumeric(request("xzid")) then
xzconn.execute("delete from xzdata where xzid="&request("xzid"))
response.write "删除成功！建议您到勋章属性管理器中进行其他操作！"
set rs=nothing
end if
end sub
%>