<!-- #include file="setup.asp" --><%



if Request.Cookies("username")=empty then error("<li>您还未<a href=login.asp>登录</a>社区")




if membercode<4 then
error("<li>您的权限不够<li>只有超级版主以上才拥有此权限")
end if


id=int(Request("id"))

url=HTMLEncode(Request("url"))
name=HTMLEncode(Request("name"))

top


select case Request("menu")

case "editok"
conn.execute("update [bbsxz] set xz1="&request("xz1")&",xz2="&request("xz2")&",xz3="&request("xz3")&",xz4="&request("xz4")&",xz5="&request("xz5")&",liyou1='"&request("liyou1")&"',liyou2='"&request("liyou2")&"',liyou3='"&request("liyou3")&"',liyou4='"&request("liyou4")&"',liyou5='"&request("liyou5")&"' where username='"&request("name")&"'")
message="<li>编辑成功<li><a href="&Request.ServerVariables("http_referer")&">"&Request.ServerVariables("http_referer")&"</a><li><a href=Default.asp>返回社区首页</a>"
succeed(""&message&"<meta http-equiv=refresh content=3;url="&Request.ServerVariables("http_referer")&">")

case "addok"
name=htmlencode(Request("name"))
If not conn.Execute("Select * From [bbsxz] where username='"&name&"'" ).eof Then error("<li>已经存在该用户的资料，请不要重复提交")
xz1=Request("xz1")
xz2=Request("xz2")
xz3=Request("xz3")
xz4=Request("xz4")
xz5=Request("xz5")
liyou1=Request("liyou1")
liyou2=Request("liyou2")
liyou3=Request("liyou3")
liyou4=Request("liyou4")
liyou5=Request("liyou5")
bftime1=now()
bftime2=now()
bftime3=now()
bftime4=now()
bftime5=now()
passname1=Request("passname1")
passname2=Request("passname2")
passname3=Request("passname3")
passname4=Request("passname4")
passname5=Request("passname5")

if xz1<>"" or xz2<>"" or xz3<>"" or xz4<>"" or xz5<>"" then
set rs2=server.createobject("adodb.recordset")
rs2.open "[bbsxz]",conn,1,3
rs2.addnew

rs2("username")=name
rs2("xz1")=xz1
rs2("xz2")=xz2
rs2("xz3")=xz3
rs2("xz4")=xz4
rs2("xz5")=xz5
rs2("liyou1")=liyou1
rs2("liyou2")=liyou2
rs2("liyou3")=liyou3
rs2("liyou4")=liyou4
rs2("liyou5")=liyou5
rs2("bftime1")=bftime1
rs2("bftime2")=bftime2
rs2("bftime3")=bftime3
rs2("bftime4")=bftime4
rs2("bftime5")=bftime5
rs2("passname1")=passname1
rs2("passname2")=passname2
rs2("passname3")=passname3
rs2("passname4")=passname4
rs2("passname5")=passname5
rs2.update
rs2.close
end if
message="<li>添加成功<li><a href=bbsxz.asp>bbsxz.asp</a><li><a href=Default.asp>返回社区首页</a>"
succeed(""&message&"<meta http-equiv=refresh content=3;url=bbsxz.asp>")

case "del"
conn.execute("delete from [bbsxz] where id="&int(request("id"))&"")
message="<li>删除成功<li><a href="&Request.ServerVariables("http_referer")&">"&Request.ServerVariables("http_referer")&"</a><li><a href=Default.asp>返回社区首页</a>"
succeed(""&message&"<meta http-equiv=refresh content=3;url="&Request.ServerVariables("http_referer")&">")

end select
%>
<table border=0 width=97% align=center cellspacing=1 cellpadding=4 class=a2>
<tr class=a3>
<td height=25>&nbsp;<img src=images/Forum_nav.gif>&nbsp; <%ClubTree%> → 
<a href="bbsxz.asp">社区勋章</a></td>
</tr>
</table><br>

<SCRIPT>valigntop()</SCRIPT>
<%

pagesetup=10 '设定每页的显示数量

select case Request("menu")
case ""
%>

<table width="97%" border=0 align=center cellPadding=3 cellSpacing=1 class=a2>
<tr class=a1><td width="33%" align="center" class=a3 height="20"><b>姓名</b></td>
	<td width="33%" align="center" class=a3 height="20"><b>勋章</b></td>
	<td width="33%" align="center" class=a3 height="20"><b>操作</b></td></tr><%

sql="select * from bbsxz order by id"
rs.Open sql,Conn,1

rs.pagesize=pagesetup
TotalPage=rs.pagecount  '总页数
PageCount = cint(Request.QueryString("ToPage"))
if PageCount <1 then PageCount = 1
if PageCount > TotalPage then PageCount = TotalPage
if TotalPage>0 then rs.absolutepage=PageCount '跳转到指定页数

i=0 
Do While Not RS.EOF and i<pagesetup 
i=i+1 

userxz=""
if conn.execute("select * from bbsxz where username='"&rs("username")&"'")(0)>0 then
set rs3=server.createobject("adodb.recordset")
rs3.open "select * from bbsxz where username='"&rs("username")&"'",conn,1,1
for i=1 to 5

xxz=rs3("xz"&i&"")
if xxz<>"" then
bftime=rs3("bftime"&i&"")
passname=rs3("passname"&i&"")
liyou=rs3("liyou"&i&"")
if isnull(passname) then
passname="无人颁发"
end if
if isnull(liyou) then
liyou="没有理由"
end if
if xxz<>"0" then
pic=conn.execute("select pic from bbsryxz where id="&xxz&"")(0)
xzname=conn.execute("select name from bbsryxz where id="&xxz&"")(0)
userxz=userxz&"<img src="&pic&" title='勋章名称:"&xzname&"<br>颁发时间:"&bftime&"<br>颁发人:"&passname&"<br>理由先:"&liyou&"'>"
end if
end if
next
rs3.close
set rs3=nothing
end if
if userxz<>"" then
%> <tr><td class=a3>
<img src="<%=conn.execute("select userface from [user] where username='"&rs("username")&"'")(0)%>" height=12> <a href="profile.asp?username=<%=rs("username")%>" target="_blank"><%=rs("username")%></a></td><td align=center class=a3><%=userxz%></td><td align=center class=a3><a href="?menu=editxz&username=<%=rs("username")%>"><img src=images/edit.gif border=0></a>　<a href="?menu=del&id=<%=rs("id")%>" onclick="checkclick('您确定要删除吗?');"><img src=images/del.gif border=0></a></td></tr><% 
end if
RS.MoveNext
loop
RS.Close      
%> <tr><td vAlign="top" colSpan="4"  class=a1 align="center"><b>&gt;&gt; 颁发勋章 (每个人只限五块)&lt;&lt;</b></td></tr><tr><td align="center" colspan="4" class=a3><form method=post name=form action="?menu=add"><input type=hidden name=menu value=add>
<b>请输入会员名称：</b><INPUT size=20 name="name">　<input type=submit value="进入颁发" name="Submit"> </td></form></tr></table>

<center><br>Page：[ 

<script>
ShowPage(<%=TotalPage%>,<%=PageCount%>,"menu=<%=Request("menu")%>")
</script>
 

 ]<br>
<%

case "editxz"
name=HTMLEncode(request("username"))
If conn.Execute("Select id From [user] where username='"&username&"'" ).eof Then message=message&"<li>此用户名不存在"
sql="select * from bbsxz where username='"&name&"'"
rs.open sql,conn,1,1
%>


<table  cellSpacing="1" cellPadding="0" width="97%" align="center" border="0" class=a2>
<form name="form1" method="post" action="?menu=editok&name=<%=name%>">
  <tr height="25">
    <td height="24" colspan="6" align="middle" class=a1>修改<%=name%>的勋章</td>
  </tr>
  <tr height="25">
    <td align="middle" height="24" class=a3 width="10%">勋章</td>
    <td align="middle" height="24" class=a3 width="15%">勋章名称</td>
    <td align="middle" height="24" class=a3 width="45%">颁发理由</td>
    <td align="middle" class=a3 width="12%">颁发人</td>
    <td align="middle" class=a3 width="18%">颁发时间</td>
  </tr>
  <tr height="25">
    <td align="middle" height="24" class=a3 width="10%">勋章一</td>
    <td align="middle" height="24" class=a3 width="10%">
    <select name="xz1">
	    <option value="0">选择勋章</option>
    <%
set rs1=server.createobject("adodb.recordset")
sql1="select * from bbsryxz"
rs1.open sql1,conn,1,1
do while not rs1.eof
%>
    <option value="<%=rs1("id")%>" <% if int(rs("xz1"))=rs1("id") then %>selected<% end if %>><%=rs1("name")%></option>
<%
rs1.movenext
loop
rs1.close
set rs1=nothing
%>
    </select>
    </td>
    <td align="middle" height="24" class=a3 width="45%"><input name="liyou1" value="<%=rs("liyou1")%>" type="text" size="45"></td>
    <td align="middle" class=a3 width="15%"><input type="text" value="<%=rs("passname1")%>" disabled size="10"></td>
    <td align="middle" class=a3 width="18%"><%=rs("bftime1")%></td>
  </tr>
  <tr height="25">
    <td align="middle" height="24" class=a3 width="10%">勋章二</td>
    <td align="middle" height="24" class=a3 width="10%">    <select name="xz2">
  	    <option value="0">选择勋章</option>
    <%
set rs1=server.createobject("adodb.recordset")
sql1="select * from bbsryxz"
rs1.open sql1,conn,1,1
do while not rs1.eof
%>
    <option value="<%=rs1("id")%>" <% if int(rs("xz2"))=rs1("id") then %>selected<% end if %>><%=rs1("name")%></option>
<%
rs1.movenext
loop
rs1.close
set rs1=nothing
%>
    </select></td>
    <td align="middle" height="24" class=a3 width="45%"><input name="liyou2" value="<%=rs("liyou2")%>" type="text" size="45"></td>
    <td align="middle" class=a3 width="15%"><input type="text" value="<%=rs("passname2")%>" disabled size="10"></td>
    <td align="middle" class=a3 width="18%"><%=rs("bftime2")%></td>
  </tr>
  <tr height="25">
    <td align="middle" height="24" class=a3 width="10%">勋章三</td>
    <td align="middle" height="24" class=a3 width="10%">    <select name="xz3">
		    <option value="0">选择勋章</option>
    <%
set rs1=server.createobject("adodb.recordset")
sql1="select * from bbsryxz"
rs1.open sql1,conn,1,1
do while not rs1.eof
%>
    <option value="<%=rs1("id")%>" <% if int(rs("xz3"))=rs1("id") then %>selected<% end if %>><%=rs1("name")%></option>
<%
rs1.movenext
loop
rs1.close
set rs1=nothing
%>
    </select></td>
    <td align="middle" height="24" class=a3 width="45%"><input name="liyou3" value="<%=rs("liyou3")%>" type="text" size="45"></td>
    <td align="middle" class=a3 width="12%"><input  type="text" value="<%=rs("passname3")%>" disabled size="10"></td>
    <td align="middle" class=a3 width="18%"><%=rs("bftime3")%></td>
  </tr>
  <tr height="25">
    <td align="middle" height="24" class=a3 width="10%">勋章四</td>
    <td align="middle" height="24" class=a3 width="10%">    <select name="xz4">
		    <option value="0">选择勋章</option>
    <%
set rs1=server.createobject("adodb.recordset")
sql1="select * from bbsryxz"
rs1.open sql1,conn,1,1
do while not rs1.eof
%>
    <option value="<%=rs1("id")%>" <% if int(rs("xz4"))=rs1("id") then %>selected<% end if %>><%=rs1("name")%></option>
<%
rs1.movenext
loop
rs1.close
set rs1=nothing
%>
    </select></td>
    <td align="middle" height="24" class=a3 width="45%"><input name="liyou4" value="<%=rs("liyou4")%>" type="text" size="45"></td>
    <td align="middle" class=a3 width="15%"><input type="text" value="<%=rs("passname4")%>" disabled size="10"></td>
    <td align="middle" class=a3 width="18%"><%=rs("bftime4")%></td>
  </tr>
  <tr height="25">
    <td align="middle" height="24" class=a3 width="10%">勋章五</td>
    <td align="middle" height="24" class=a3 width="10%">    <select name="xz5">
		    <option value="0">选择勋章</option>
    <%
set rs1=server.createobject("adodb.recordset")
sql1="select * from bbsryxz"
rs1.open sql1,conn,1,1
do while not rs1.eof
%>
    <option value="<%=rs1("id")%>" <% if int(rs("xz5"))=rs1("id") then %>selected<% end if %>><%=rs1("name")%></option>
<%
rs1.movenext
loop
rs1.close
set rs1=nothing
%>
    </select></td>
    <td align="middle" height="24" class=a3 width="45%"><input name="liyou5" value="<%=rs("liyou5")%>" type="text" size="45"></td>
    <td align="middle" class=a3 width="15%"><input type="text" value="<%=rs("passname5")%>" disabled size="10"></td>
    <td align="middle" class=a3 width="18%"><%=rs("bftime5")%></td>
  </tr>
<tr height="25">
    <td height="24" colspan="6" align="middle" class=a3><input type="submit" name="Submit" value="　　　提 交　　　"></td>
  </tr>
</form>
</table>





<%

case "add"
name=HTMLEncode(request("name"))
if name="" then error2("请输入用户名")
If conn.Execute("Select * From [user] where username='"&name&"'" ).eof Then error2("此用户名不存在")
If not conn.Execute("Select * From [bbsxz] where username='"&name&"'" ).eof Then error("<li>已经存在该用户的资料，请不要重复提交")
%>


<table  cellSpacing="1" cellPadding="0" width="97%" align="center" border="0" class=a2>
<form name="form1" method="post" action="?menu=addok&name=<%=name%>">
  <tr height="25">
    <td height="24" colspan="6" align="middle" class=a1>颁发<%=name%>的勋章</td>
  </tr>
  <tr height="25">
    <td align="middle" height="24" class=a1 width="10%">勋章</td>
    <td align="middle" height="24" class=a1 width="15%">勋章名称</td>
    <td align="middle" height="24" class=a1 width="45%">颁发理由</td>
    <td align="middle" class=a1 width="12%">颁发人</td>
  </tr>
  <tr height="25">
    <td align="middle" height="24" class=a1 width="10%">勋章一</td>
    <td align="middle" height="24" class=a3 width="10%">
    <select name="xz1">
    <option value="0">选择勋章</option>
    <%
set rs1=server.createobject("adodb.recordset")
sql1="select * from bbsryxz"
rs1.open sql1,conn,1,1
do while not rs1.eof
%>
    <option value="<%=rs1("id")%>"><%=rs1("name")%></option>
<%
rs1.movenext
loop
rs1.close
set rs1=nothing
%>
    </select>
    </td>
    <td align="middle" height="24" class=a3 width="45%"><input name="liyou1" value="" type="text" size="45"></td>
    <td align="middle" class=a3 width="15%"><input type="text" name="passname1" value="" size="10"></td>
  </tr>
  <tr height="25">
    <td align="middle" height="24" class=a1 width="10%">勋章二</td>
    <td align="middle" height="24" class=a3 width="10%">    <select name="xz2">
    <option value="0">选择勋章</option>
    <%
set rs1=server.createobject("adodb.recordset")
sql1="select * from bbsryxz"
rs1.open sql1,conn,1,1
do while not rs1.eof
%>
    <option value="<%=rs1("id")%>"><%=rs1("name")%></option>
<%
rs1.movenext
loop
rs1.close
set rs1=nothing
%>
    </select></td>
    <td align="middle" height="24" class=a3 width="45%"><input name="liyou2" value="" type="text" size="45"></td>
    <td align="middle" class=a3 width="15%"><input type="text" value="" name="passname2" size="10"></td>
  </tr>
  <tr height="25">
    <td align="middle" height="24" class=a1 width="10%">勋章三</td>
    <td align="middle" height="24" class=a3 width="10%">    <select name="xz3">
    <option value="0">选择勋章</option>
    <%
set rs1=server.createobject("adodb.recordset")
sql1="select * from bbsryxz"
rs1.open sql1,conn,1,1
do while not rs1.eof
%>
    <option value="<%=rs1("id")%>"><%=rs1("name")%></option>
<%
rs1.movenext
loop
rs1.close
set rs1=nothing
%>
    </select></td>
    <td align="middle" height="24" class=a3 width="45%"><input name="liyou3" value="" type="text" size="45"></td>
    <td align="middle" class=a3 width="12%"><input  type="text" name="passname3" value="" size="10"></td>
  </tr>
  <tr height="25">
    <td align="middle" height="24" class=a1 width="10%">勋章四</td>
    <td align="middle" height="24" class=a3 width="10%">    <select name="xz4">
    <option value="0">选择勋章</option>
    <%
set rs1=server.createobject("adodb.recordset")
sql1="select * from bbsryxz"
rs1.open sql1,conn,1,1
do while not rs1.eof
%>
    <option value="<%=rs1("id")%>"><%=rs1("name")%></option>
<%
rs1.movenext
loop
rs1.close
set rs1=nothing
%>
    </select></td>
    <td align="middle" height="24" class=a3 width="45%"><input name="liyou4" value="" type="text" size="45"></td>
    <td align="middle" class=a3 width="15%"><input type="text" value="" name="passname4" size="10"></td>
  </tr>
  <tr height="25">
    <td align="middle" height="24" class=a1 width="10%">勋章五</td>
    <td align="middle" height="24" class=a3 width="10%">    <select name="xz5">
    <option value="0">选择勋章</option>
    <%
set rs1=server.createobject("adodb.recordset")
sql1="select * from bbsryxz"
rs1.open sql1,conn,1,1
do while not rs1.eof
%>
    <option value="<%=rs1("id")%>"><%=rs1("name")%></option>
<%
rs1.movenext
loop
rs1.close
set rs1=nothing
%>
    </select></td>
    <td align="middle" height="24" class=a3 width="45%"><input name="liyou5" value="" type="text" size="45"></td>
    <td align="middle" class=a3 width="15%"><input type="text" value="" name="passname5" size="10"></td>
  </tr>
<tr height="25">
    <td height="24" colspan="6" align="middle" class=a3><input type="submit" name="Submit" value="　　　提 交　　　"></td>
  </tr>
</form>
</table>

<%

end select

%>

<SCRIPT>valignbottom()</SCRIPT>


<%
htmlend
%>