<!--#include file="setup.asp"-->
<!-- #include file=pet_conn.asp -->
<!--#include file="pet_config.asp"-->
<%
top
if Request.Cookies("username")=empty then error("<li>您还未<a href=login.asp>登录</a>论坛")
    dim allpetpeople,money,mypetname,mypet,levelpic,mypetlevel,username,level1,petatk,petdef,petdead
    Dim rs_pet,sql_pet
    set rs_pet=conn.execute("select money from [user] where username='"&Request.Cookies("username")&"'")
    money=rs_pet("money")
    rs_pet.close
%>
<title>宠物排行榜</title>
<table border=0 width=<%=dkuan%> 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="petcenter.asp">宠物中心</a></td>
</tr>
</table><br>
  
<table width="<%=dkuan%>" align=center border="0" cellspacing="2" cellpadding="2">
              <tr>
                <td width="30%">
                  <table width="90%"  border="0" align="center" cellpadding="3" cellspacing="3">
                    <tr> 
                      <td><div align="center"></div>
<!-- #include file=petnav.asp --></td>
                    </tr>
                  </table>
<table height=100%><tr><td></td></tr></table>
                  <p>&nbsp;</p>
                  </td>
                <td>

<%
    select case lcase(request("action"))
        case "pkon"
%>
                  <table width="100%" border="0" align="center" cellpadding="3" cellspacing="3">
                    <tr>
                      <td width="20%"><div align="center">宠物主人</div></td>
                      <td width="20%"><div align="center">宠物名字</div></td>
                      <td width="15%"><div align="center">宠物等级</div></td>
                      <td width="15%"><div align="center">宠物攻击力</div></td>
                      <td width="15%"><div align="center">宠物防御力</div></td>
                      <td width="15%"><div align="center">宠物状态</div></td>
                    </tr>
<%
            sql_pet = "SELECT * FROM mypetdata where openpk<2 ORDER BY mypetexp DESC"
            set rs_pet = conn_pet.execute(sql_pet)
            while not rs_pet.eof 
                    level1=int(rs_pet("mypetlevel")/2)
                    petatk=rs_pet("mypetatk")+rs_pet("item1")+rs_pet("item2")+2+level1
                    petdef=rs_pet("mypetdef")+rs_pet("item3")+rs_pet("item4")+rs_pet("item5")+3+level1
                    if rs_pet("mypethp")<1 or rs_pet("mypetsp")<1 then 
                        petdead="死亡"
                        else
                        petdead="生存"
                    end if
%>
                    <tr><td width='20%'><div align='center'><a href="profile.asp?username=<%=rs_pet("username")%>"><%=rs_pet("username")%></a></div></td>
                    <td width="20%"><div align="center"><a href="petview.asp?username=<%=rs_pet("username")%>"><%=rs_pet("mypet")%></a></div></td>
                    <td width='15%'><div align='center'><%=rs_pet("mypetlevel")%></div></td>
                    <td width='15%'><div align='center'><%=petatk%></div></td>
                    <td width='15%'><div align='center'><%=petdef%></div></td>
                    <td width='15%'><div align='center'><%=petdead%></div></td>
                    </tr>
<%              rs_pet.movenext    
            wend
            rs_pet.close
%>                    
                    </table>

<%
        case else 'pettop
%>
<TABLE cellSpacing=1 cellPadding=3 width="97%" align="center" valign="top" border=0 class=a2>
                    <tr colspan="3" class=a1>
                      <td width="28%"><div align="center">宠物照片</div></td>
                      <td width="24%"><div align="center">宠物名字</div></td>
                      <td width="24%"><div align="center">宠物等级</div></td>
                      <td width="24%"><div align="center">宠物主人</div></td>
                    </tr>

<%
            sql_pet = "SELECT top 10 username,mypet,mypetlevel,mypetname FROM mypetdata ORDER BY mypetlevel desc,mypetexp DESC"
            set rs_pet = conn_pet.execute(sql_pet)
            dim num
            num = 0
            while not rs_pet.eof and num < 10
                levelpic=int(rs_pet("mypetlevel")/10)
                if levelpic>10 then levelpic=11 end if
%>
                    <tr colspan="3" class=a3><td width='28%'><div align='center'><IMG src='images/pet/<%=rs_pet("mypetname")%>/<%=rs_pet("mypetname")%><%=levelpic%>.gif'></div></td>
                    <td width='24%'><div align='center'><a href="petview.asp?username=<%=rs_pet("username")%>"><%=rs_pet("mypet")%></a></div></td>
                    <td width='24%'><div align='center'><%=rs_pet("mypetlevel")%></div></td>
                    <td width='24%'><div align='center'><a href="profile.asp?username=<%=rs_pet("username")%>"><%=rs_pet("username")%></a></div></td>
                    </tr>
<%              rs_pet.movenext    
                num = num + 1
            wend
            rs_pet.close
%>
                    </table>
<%            
    end select
%>                  
<table height=100%><tr><td></td></tr></table>
                </td>
              </tr>
            </table> 
<%
htmlend
%>
