<!-- #include file=../../inc/BBSsetup.asp -->
<!-- #include file=../../inc/Board_popfun.asp -->
<!-- #include file=pet_conn.asp -->
<!--#include file=pet_config.asp-->
<%
DEF_BBS_HomeUrl = "../../"
dim menu,savem,rsbank,rssql,chentitle,chenbackasp,stats,errmsg,founderr,action

chentitle="宠物管理区"
chenbackasp="petcenter.asp"
stats="宠物管理区"
BBS_SiteHead DEF_SiteNameString&" "&DEF_BBS_Name,GBL_board_ID,">>&nbsp;<a href=petcenter.asp>宠物中心</a>&nbsp;>>&nbsp;" & chentitle

If CheckSupervisorUserName <> 1 Then
    call showmessage("你不是社区管理员，不能进入宠物管理区~","petcenter.asp")
end if

if GBL_CHK_User="" then
	AlarmErrmsg
else
    dim money,smoney,saveday,allmoney,time1,time2,daikuang,dkdu,daiday,sucmsg
    dim Form_userphoto,Form_FaceUrl,Form_FaceWidth,Form_FaceHeight
    dim rs,sql

action = request("action")
if action = "" then 
    action = "config"
end if


select case action

case "changeconfig" 
    config_file

sub config_file()
  dim filetype,file_name
  
  DEF_PET_namelong = request("DEF_PET_namelong")
  DEF_PET_basichp = request("DEF_PET_basichp")
  DEF_PET_basicsp = request("DEF_PET_basicsp")
  DEF_PET_basicsp2 = request("DEF_PET_basicsp2")
  DEF_PET_eggmoney = request("DEF_PET_eggmoney")
  DEF_PET_basichpmoney = request("DEF_PET_basichpmoney")
  DEF_PET_basicspmoney = request("DEF_PET_basicspmoney")
  DEF_PET_basicexpmoney = request("DEF_PET_basicexpmoney")
  DEF_PET_atkmoney = request("DEF_PET_atkmoney")
  DEF_PET_defmoney = request("DEF_PET_defmoney")
  DEF_PET_livemoney = request("DEF_PET_livemoney")
  DEF_PET_basicusehp = request("DEF_PET_basicusehp")
  DEF_PET_basicusesp = request("DEF_PET_basicusesp")
  DEF_PET_basicuseexp = request("DEF_PET_basicuseexp")
  DEF_PET_atkup = request("DEF_PET_atkup")
  DEF_PET_defup = request("DEF_PET_defup")
  DEF_PET_petpkhp = request("DEF_PET_petpkhp")
  DEF_PET_petpktime = request("DEF_PET_petpktime")
  DEF_PET_petpklv = request("DEF_PET_petpklv")
  DEF_PET_changesexmoney = request("DEF_PET_changesexmoney")
  DEF_PET_perswordmoney = request("DEF_PET_perswordmoney")
  DEF_PET_pernecklacemoney = request("DEF_PET_pernecklacemoney")
  DEF_PET_perheadmoney = request("DEF_PET_perheadmoney")
  DEF_PET_perbodyemoney = request("DEF_PET_perbodyemoney") 
  DEF_PET_perfootmoney = request("DEF_PET_perfootmoney")
  DEF_PET_nameexpt = request("DEF_PET_nameexpt")
  DEF_PET_newtopicexp = request("DEF_PET_newtopicexp")
  DEF_PET_replytopicexp = request("DEF_PET_replytopicexp")
  DEF_PET_sendbattlemsg = request("DEF_PET_sendbattlemsg")
  
  dim errorflag
  if not isnumeric(DEF_PET_namelong) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basichp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basicsp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basicsp2) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_eggmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basichpmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basicspmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basicexpmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_atkmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_defmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_livemoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basicusehp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basicusesp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basicuseexp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_atkup) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_defup) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_petpkhp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_petpktime) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_petpklv) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_changesexmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_perswordmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_pernecklacemoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_perheadmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_perbodyemoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_perfootmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_newtopicexp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_replytopicexp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_sendbattlemsg) then
      errorflag = 1
  end if  
  
  if errorflag=1 then
      call showmessage("至少有一项设置填写有误，请按要求填写~","pet_config_edit.asp")
  end if
  
  filetype=filetype&"<"&""&"%" & vbcrlf & _
    "dim DEF_PET_version,DEF_PET_close,DEF_PET_message,DEF_PET_namelong,DEF_PET_basichp,DEF_PET_basicsp,DEF_PET_basicsp2" & vbcrlf & _
    "dim DEF_PET_eggmoney,DEF_PET_basichpmoney,DEF_PET_basicspmoney,DEF_PET_basicexpmoney,DEF_PET_atkmoney,DEF_PET_defmoney" & vbcrlf & _
    "dim DEF_PET_livemoney,DEF_PET_basicusehp,DEF_PET_basicusesp,DEF_PET_basicuseexp,DEF_PET_atkup,DEF_PET_defup,DEF_PET_petpkhp" & vbcrlf & _
    "dim DEF_PET_petpktime,DEF_PET_petpklv,DEF_PET_changesexmoney,DEF_PET_perswordmoney,DEF_PET_pernecklacemoney" & vbcrlf & _
    "dim DEF_PET_perheadmoney,DEF_PET_perbodyemoney,DEF_PET_perfootmoney,DEF_PET_nameexpt,DEF_PET_author" & vbcrlf & _
    "dim DEF_PET_newtopicexp,DEF_PET_replytopicexp,DEF_PET_sendbattlemsg" & vbcrlf & _
    "   " & vbcrlf & _
    "DEF_PET_author = ""<a href=http://www.chenwang.net/leadbbs>尘网社区</a>，作者Jesse(QQ:3083445)""              '程序制作" & vbcrlf & _
    "DEF_PET_version = ""宠物中心 v1.1""             '程序版本" & vbcrlf & _
    "DEF_PET_close = 0                     '保留" & vbcrlf & _
    "DEF_PET_message = """"                  '保留" & vbcrlf & _
    "DEF_PET_namelong = "&DEF_PET_namelong&"                 '宠物的名字长度10" & vbcrlf & _
    "DEF_PET_nameexpt = """&DEF_PET_nameexpt&"""                 '宠物名字过滤字符，不允许的宠物名字" & vbcrlf & _
    "DEF_PET_basichp = "&DEF_PET_basichp&"                 '宠物的体力值,建议100" & vbcrlf & _
    "DEF_PET_basicsp = "&DEF_PET_basicsp&"               '宠物的饥饿值,建议10000" & vbcrlf & _
    "DEF_PET_basicsp2 = "&DEF_PET_basicsp2&"                '每天宠物消耗饥饿值,建议500，注意不要超过SP的基本量" & vbcrlf & _
    "DEF_PET_eggmoney = "&DEF_PET_eggmoney&"                  '基本宠物蛋价格" & vbcrlf & _
    "DEF_PET_basichpmoney = "&DEF_PET_basichpmoney&"             '恢复宠物体力药水的价格,建议1000    " & vbcrlf & _
    "DEF_PET_basicspmoney = "&DEF_PET_basicspmoney&"              '恢复宠物饥饿值药水的价格，建议500" & vbcrlf & _
    "DEF_PET_basicexpmoney = "&DEF_PET_basicexpmoney&"           '增加宠物经验值药水的价格，建议价格设置贵一些" & vbcrlf & _
    "DEF_PET_atkmoney = "&DEF_PET_atkmoney&"                 '攻击力药水的价格" & vbcrlf & _
    "DEF_PET_defmoney = "&DEF_PET_defmoney&"                 '防御力药水的价格" & vbcrlf & _
    "DEF_PET_livemoney = "&DEF_PET_livemoney&"                 '复活药水的价格" & vbcrlf & _
    "DEF_PET_basicusehp = "&DEF_PET_basicusehp&"              '使用一次增加宠物体力的数量，建议100" & vbcrlf & _
    "DEF_PET_basicusesp = "&DEF_PET_basicusesp&"             '使用一次增加宠物饥饿的数量，建议100" & vbcrlf & _
    "DEF_PET_basicuseexp = "&DEF_PET_basicuseexp&"              '使用一次增加宠物经验的数量，建议50数量不要太大" & vbcrlf & _
    "DEF_PET_atkup = "&DEF_PET_atkup&"                     '使用攻击力药水的增加量，建议不要超过5" & vbcrlf & _
    "DEF_PET_defup = "&DEF_PET_defup&"                     '使用防御力药水的增加量，建议不要超过5" & vbcrlf & _
    "DEF_PET_petpkhp = "&DEF_PET_petpkhp&"                   '宠物之间PK时候当一方宠物低于多少PK便停止，如果设置为1则直到一方死亡PK才告结束，如果想要一方死亡PK才结束，请设置为1" & vbcrlf & _
    "DEF_PET_petpktime = "&DEF_PET_petpktime&"                '宠物PK时的攻击间隔，为了防止恶意刷新请设置100以上,以秒为单位" & vbcrlf & _
    "DEF_PET_petpklv = "&DEF_PET_petpklv&"                  '宠物之间PK时候当两个宠物级别低于这个值时，不能PK，建议设置10以上" & vbcrlf & _
    "DEF_PET_changesexmoney = "&DEF_PET_changesexmoney&"           '宠物变性手术价格" & vbcrlf & _
    "DEF_PET_perswordmoney = "&DEF_PET_perswordmoney&"            '每1点攻击力武器价格" & vbcrlf & _
    "DEF_PET_pernecklacemoney = "&DEF_PET_pernecklacemoney&"         '每1点攻击力项链价格" & vbcrlf & _
    "DEF_PET_perheadmoney = "&DEF_PET_perheadmoney&"             '每1点防御力头盔价格" & vbcrlf & _
    "DEF_PET_perbodyemoney = "&DEF_PET_perbodyemoney&"            '每1点防御力盔甲价格" & vbcrlf & _
    "DEF_PET_perfootmoney = "&DEF_PET_perfootmoney&"             '每1点防御力鞋子价格    " & vbcrlf & _
    "DEF_PET_replytopicexp = "&DEF_PET_replytopicexp&"             '回复主题时给作者的宠物增加的exp点数    " & vbcrlf & _
    "DEF_PET_newtopicexp = "&DEF_PET_newtopicexp&"               '发表新主题时给作者的宠物增加的exp点数    " & vbcrlf & _
    "DEF_PET_sendbattlemsg = "&DEF_PET_sendbattlemsg&"             '是否发送攻击短消息，1为发送，0为不发送" & vbcrlf & _
	"%"&""&">"
  file_name="pet_config.asp"
  call create_file(file_name,filetype)
  
  call showmessage("成功保存各项设置~","pet_config_edit.asp")
end sub


sub create_file(file_name,filetype)
  dim filetemp,fileos,filepath
  set fileos=CreateObject("Scripting.FileSystemObject")
  filepath=server.mappath(file_name)
  set filetemp=fileos.createtextfile(filepath,true)
  filetemp.writeline( filetype )
  filetemp.close
  set filetemp=nothing
  set fileos=nothing
end sub

case "delpet"
    if request("petid") <> "" and isnumeric(request("petid")) then
        connpet.ExeCute("DELETE FROM mypetdata WHERE id = " & request("petid"))
        call showmessage("成功删除该用户的宠物~","pet_config_edit.asp?action=userpet")
        else
        call showmessage("该用户还没有宠物~","pet_config_edit.asp?action=userpet")
    end if
case "delallbattlemsg"
    OpenDatabase
    SQL = "DELETE FROM LeadBBS_InfoBox where FromUser = '宠物管理员'"
    con.ExeCute(SQL)
    CloseDatabase
    call showmessage("成功删除所有竞技短消息~","pet_config_edit.asp?action=battlemsg")
case "delreadbattlemsg"    
    OpenDatabase
    SQL = "DELETE FROM LeadBBS_InfoBox where ReadFlag = 1 and FromUser = '宠物管理员'"
    con.ExeCute(SQL)
    CloseDatabase
    call showmessage("成功删除所有已读竞技短消息~","pet_config_edit.asp?action=battlemsg")
end select

%>
<% If GBL_TableHeadString <> "" Then %><table width=<%=DEF_BBS_ScreenWidth%> border=0 cellspacing=0 cellpadding=0 align=center><tr><td><%=GBL_TableHeadString%></td></tr></table><% End If %>
<table width="<%=DEF_BBS_ScreenWidth%>" border="0" cellspacing="1" cellpadding="5" align="center" class=TBone>
  <tr>
    <td height=27 align="center" class=tbhead2><b><font class=HeadFont><%=stats%></font></b></td>
  </tr>
  <tr>
    <td class=tbbg1>

<table width="99%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="33%"><div align="center"><a href="?action=config">宠物参数设置</a></div></td>
<td width="33%"><div align="center"><a href="?action=userpet">用户宠物管理</a></div></td>
<td width="33%"><div align="center"><a href="?action=battlemsg">竞技消息删除</a></div></td>
</tr></table>    

    </td>
  </tr>
  <tr>
    <td class=tbbg1>
<%if action="config" then%>
<div align="center">
<table width="95%" border="1" cellspacing=0 cellpadding=2 bordercolorlight=#c0c0c0 bordercolordark=#FFFFFF>
<tr align=center>
<td width='36%'>设置名称</td>
<td width='20%'>参数</td>
<td width='34%'>相关说明</td>
</tr>
<form action='pet_config_edit.asp' method=post>

<tr>
<td>程序制作：</td>
<td><%=DEF_PET_author%></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>版本信息：</td>
<td><%=DEF_PET_version%></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>宠物名字长度：</td>
<td><input type=text class=fminpt name="DEF_PET_namelong" value='<%=DEF_PET_namelong%>' size=38 maxlength=50></td>
<td>用户自定义宠物的名字长度</td>
</tr>
<tr>
<td>宠物名字过滤：</td>
<td><input type=text class=fminpt name="DEF_PET_nameexpt" value='<%=DEF_PET_nameexpt%>' size=38 maxlength=50></td>
<td>不允许的宠物名字,使用"|"隔开</td>
</tr>
<tr>
<td>宠物的体力值：</td>
<td><input type=text class=fminpt name="DEF_PET_basichp" value='<%=DEF_PET_basichp%>' size=38 maxlength=50></td>
<td>建议100</td>
</tr>
<tr>
<td>宠物的饥饿值：</td>
<td><input type=text class=fminpt name="DEF_PET_basicsp" value='<%=DEF_PET_basicsp%>' size=38 maxlength=50></td>
<td>建议10000</td>
</tr>
<tr>
<td>每天宠物消耗饥饿值：</td>
<td><input type=text class=fminpt name="DEF_PET_basicsp2" value='<%=DEF_PET_basicsp2%>' size=38 maxlength=50></td>
<td>建议500，注意不要超过SP的基本量</td>
</tr>
<tr>
<td>基本宠物蛋价格：</td>
<td><input type=text class=fminpt name="DEF_PET_eggmoney" value='<%=DEF_PET_eggmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%></td>
</tr>
<tr>
<td>恢复宠物体力药水的价格：</td>
<td><input type=text class=fminpt name="DEF_PET_basichpmoney" value='<%=DEF_PET_basichpmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>，建议1000</td>
</tr>
<tr>
<td>恢复宠物饥饿值药水的价格：</td>
<td><input type=text class=fminpt name="DEF_PET_basicspmoney" value='<%=DEF_PET_basicspmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>，建议500</td>
</tr>
<tr>
<td>增加宠物经验值药水的价格：</td>
<td><input type=text class=fminpt name="DEF_PET_basicexpmoney" value='<%=DEF_PET_basicexpmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>，建议价格设置贵一些</td>
</tr>
<tr>
<td>攻击力药水的价格：</td>
<td><input type=text class=fminpt name="DEF_PET_atkmoney" value='<%=DEF_PET_atkmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%></td>
</tr>
<tr>
<td>防御力药水的价格：</td>
<td><input type=text class=fminpt name="DEF_PET_defmoney" value='<%=DEF_PET_defmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%></td>
</tr>
<tr>
<td>复活药水的价格：</td>
<td><input type=text class=fminpt name="DEF_PET_livemoney" value='<%=DEF_PET_livemoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%></td>
</tr>
<tr>
<td>使用一次增加宠物体力的数量：</td>
<td><input type=text class=fminpt name="DEF_PET_basicusehp" value='<%=DEF_PET_basicusehp%>' size=38 maxlength=50></td>
<td>建议100</td>
</tr>
<tr>
<td>使用一次增加宠物饥饿的数量：</td>
<td><input type=text class=fminpt name="DEF_PET_basicusesp" value='<%=DEF_PET_basicusesp%>' size=38 maxlength=50></td>
<td>建议100</td>
</tr>
<tr>
<td>使用一次增加宠物经验的数量：</td>
<td><input type=text class=fminpt name="DEF_PET_basicuseexp" value='<%=DEF_PET_basicuseexp%>' size=38 maxlength=50></td>
<td>建议50数量不要太大</td>
</tr>
<tr>
<td>使用攻击力药水的增加量：</td>
<td><input type=text class=fminpt name="DEF_PET_atkup" value='<%=DEF_PET_atkup%>' size=38 maxlength=50></td>
<td>建议不要超过5</td>
</tr>
<tr>
<td>使用防御力药水的增加量：</td>
<td><input type=text class=fminpt name="DEF_PET_defup" value='<%=DEF_PET_defup%>' size=38 maxlength=50></td>
<td>建议不要超过5</td>
</tr>
<tr>
<td>PK时当一方宠物HP低于多少便停止：</td>
<td><input type=text class=fminpt name="DEF_PET_petpkhp" value='<%=DEF_PET_petpkhp%>' size=38 maxlength=50></td>
<td>如果设置为1则直到一方死亡PK才告结束，如果想要一方死亡PK才结束，请设置为1</td>
</tr>
<tr>
<td>宠物PK时的攻击间隔：</td>
<td><input type=text class=fminpt name="DEF_PET_petpktime" value='<%=DEF_PET_petpktime%>' size=38 maxlength=50></td>
<td>为了防止恶意刷新请设置100以上,以秒为单位</td>
</tr>
<tr>
<td>宠物之间PK级别间隔：</td>
<td><input type=text class=fminpt name="DEF_PET_petpklv" value='<%=DEF_PET_petpklv%>' size=38 maxlength=50></td>
<td>宠物之间PK时候当两个宠物级别低于这个值时，不能PK建议设置10以上</td>
</tr>
<tr>
<td>宠物变性手术价格：</td>
<td><input type=text class=fminpt name="DEF_PET_changesexmoney" value='<%=DEF_PET_changesexmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%></td>
</tr>
<tr>
<td>每1点攻击力武器价格：</td>
<td><input type=text class=fminpt name="DEF_PET_perswordmoney" value='<%=DEF_PET_perswordmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%></td>
</tr>
<tr>
<td>每1点攻击力项链价格：</td>
<td><input type=text class=fminpt name="DEF_PET_pernecklacemoney" value='<%=DEF_PET_pernecklacemoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%></td>
</tr>
<tr>
<td>每1点防御力头盔价格：</td>
<td><input type=text class=fminpt name="DEF_PET_perheadmoney" value='<%=DEF_PET_perheadmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%></td>
</tr>
<tr>
<td>每1点防御力盔甲价格：</td>
<td><input type=text class=fminpt name="DEF_PET_perbodyemoney" value='<%=DEF_PET_perbodyemoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%></td>
</tr>
<tr>
<td>每1点防御力鞋子价格：</td>
<td><input type=text class=fminpt name="DEF_PET_perfootmoney" value='<%=DEF_PET_perfootmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%></td>
</tr>
<tr>
<td>回复主题增加经验值：</td>
<td><input type=text class=fminpt name="DEF_PET_replytopicexp" value='<%=DEF_PET_replytopicexp%>' size=38 maxlength=50></td>
<td>EXP</td>
</tr>
<tr>
<td>发表主题增加经验值：</td>
<td><input type=text class=fminpt name="DEF_PET_newtopicexp" value='<%=DEF_PET_newtopicexp%>' size=38 maxlength=50></td>
<td>EXP</td>
</tr>
<tr>
<td>是否发送攻击短消息：</td>
<td><input type=text class=fminpt name="DEF_PET_sendbattlemsg" value='<%=DEF_PET_sendbattlemsg%>' size=38 maxlength=50></td>
<td>1为发送，0为不发送</td>
</tr>

<tr>
<td colspan="3">
注意：以上宠物名字过滤字符使用"|"隔开，其它各项必须填写数字。
</td>
</tr>                          
<tr>
<td colspan="3" align="center">
<input type="hidden" name="action" value="changeconfig"> 
<input type="submit" value="提交修改" class=fmbtn>
</td>
</tr>                          
</form>
</table>
</div>
<%end if%>

<%if action="userpet" then%>
<div align="center">
<table width="95%" border="1" cellspacing=0 cellpadding=2 bordercolorlight=#c0c0c0 bordercolordark=#FFFFFF>
<form name="searchuser" method="POST" action="pet_config_edit.asp?action=userpet">
<tr><td align="center">点击宠物名字查看详细,查找用户的宠物:  <input type="text" name="txtitle" size="13" class=fminpt>	<input type="submit" value="查询" name="title" class=fmbtn>                                            
</td></tr>
</form>
</table>                                      
<table width="95%" border="1" cellspacing=0 cellpadding=2 bordercolorlight=#c0c0c0 bordercolordark=#FFFFFF>
<tr align=center>
<td width='20%'>宠物主人</td>
<td width='20%'>宠物名字</td>
<td width='10%'>宠物等级</td>
<td width='10%'>宠物攻击力</td>
<td width='10%'>宠物防御力</td>
<td width='15%'>相关状态</td>
<td width='15%'>相关操作</td>
</tr>

<%
dim title 
title=request("txtitle") 
if not isempty(request("page")) then 
  		currentPage=cint(request("page")) 
else 
  		currentPage=1 
end if 

if title = "" then
sql = "select * from mypetdata ORDER BY mypetlevel DESC"
else
sql = "select * from mypetdata where username like '%"& title &"%' ORDER BY mypetlevel DESC"
end if
set rs = server.createobject("adodb.recordset")
rs.open sql,connpet,1,1
if rs.eof then
    %>
<tr>
<td colspan="7" align="center">社区无人领养宠物</td>
</tr>
    <%
    else
      		dim totalPut,currentpage,MaxAnnouncePerpage
      		MaxAnnouncePerPage=25
      		
      		totalPut=rs.recordcount
      		if currentpage<1 then
          		currentpage=1
      		end if
			MaxAnnouncePerpage=Clng(MaxAnnouncePerpage)                                          
      		if (currentpage-1)*MaxAnnouncePerPage>totalput then                                           
				if (totalPut mod MaxAnnouncePerPage)=0 then                                           
						currentpage= totalPut \ MaxAnnouncePerPage                                           
				else                                           
						currentpage= totalPut \ MaxAnnouncePerPage + 1                                           
				end if                                           
      		end if                                           
       		if currentPage=1 then                                           
            		showContent                                           
            		showpage totalput,MaxAnnouncePerPage,"pet_config_edit.asp?action=userpet"
       		else                                           
          		if (currentPage-1)*MaxAnnouncePerPage<totalPut then                                           
            			rs.move  (currentPage-1)*MaxAnnouncePerPage                                          
            			dim bookmark                                           
            			bookmark=rs.bookmark                                            
            			showContent                                           
             			showpage totalput,MaxAnnouncePerPage,"pet_config_edit.asp?action=userpet"                                           
        		else                                           
	        		currentPage=1                                           
           			showContent                                           
           			showpage totalput,MaxAnnouncePerPage,"pet_config_edit.asp?action=userpet"                                           
	      		end if                                           
	   		end if                  
end if
%>
</table>
</div>
<%
sub showContent                                          
   	dim i                                          
	i=0                                          
	dim saveday,level1,petatk,petdef
	do while not rs.eof

    level1=int(rs("mypetlevel")/2)
    petatk=rs("mypetatk")+rs("item1")+rs("item2")+2+level1
    petdef=rs("mypetdef")+rs("item3")+rs("item4")+rs("item5")+3+level1

%>                                          
<tr align="center">
<td><a href="../../User/LookUserinfo.asp?name=<%=rs("username")%>" target="viewuser"><%=rs("username")%></a></td>
<td><a href="viewpet.asp?username=<%=rs("username")%>" target="viewpet"><%=rs("mypet")%></a></td>
<td><%=rs("mypetlevel")%></td>
<td><%=petatk%></td>
<td><%=petdef%></td>
<td>
<%
if rs("mypethp")<1 or rs("mypetsp")<1 then 
response.write "死亡"
else
response.write "生存"
end if
%>
</td>
<td><a href="?action=delpet&petid=<%=rs("id")%>" onclick="javascript:{if(confirm('您确定执行删除操作吗?')){return true;}return false;}">删除</a></td>
</tr>
<%                                           
	i=i+1                                          
	if i>=MaxAnnouncePerPage then exit do                                          
	rs.movenext                                          
	loop                                          
end sub

function showpage(totalnumber,MaxAnnouncePerPage,filename)                                          
%>
<div align="center">
<table width="95%" border="1" cellspacing=0 cellpadding=2 bordercolorlight=#c0c0c0 bordercolordark=#FFFFFF>
<tr>
<td>
<%
    dim n                                    
  if totalnumber mod MaxAnnouncePerPage=0 then                                          
     n= totalnumber \ MaxAnnouncePerPage                                          
  else                                          
     n= totalnumber \ MaxAnnouncePerPage+1                                          
  end if                                          
  response.write "<p align='center'>&nbsp;"                                          
  if CurrentPage<2 then                                          
    response.write "首页 上一页&nbsp;"                                          
  else                                          
    response.write "<a href="&filename&"&page=1&txtitle="&request("txtitle")&">首页</a>&nbsp;"                                          
    response.write "<a href="&filename&"&page="&CurrentPage-1&"&txtitle="&request("txtitle")&">上一页</a>&nbsp;"                                          
  end if                                          
  if n-currentpage<1 then                                          
    response.write "下一页 尾页"                                          
  else                                          
    response.write "<a href="&filename&"&page="&(CurrentPage+1)&"&txtitle="&request("txtitle")&">"                                          
    response.write "下一页</a> <a href="&filename&"&page="&n&"&txtitle="&request("txtitle")&">尾页</a>"                                          
  end if                                          
   response.write "&nbsp;页次：</font><strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "                                          
   response.write "&nbsp;共<b>"&totalnumber&"</b>个用户 <b>"&MaxAnnouncePerPage&"</b>个用户/页 "                                          
%>
</td>
</tr>
</table>
</div>
<%
end function                                          

end if%>

<%if action="battlemsg" then
    dim allbattlemsg,readbattlemsg
    OpenDatabase
    SQL = "SELECT COUNT(FromUser) FROM LeadBBS_InfoBox where FromUser = '宠物管理员'"
    set rs = server.createobject("adodb.recordset")
    rs.open SQL,con,1,3
    allbattlemsg = rs(0)
    rs.close
    
    SQL = "SELECT COUNT(FromUser) FROM LeadBBS_InfoBox where ReadFlag = 1 and FromUser = '宠物管理员'"
    rs.open SQL,con,1,3
    readbattlemsg = rs(0)
    rs.close
    
    CloseDatabase
%>
<div align="center">
<table width="95%" border="1" cellspacing=0 cellpadding=2 bordercolorlight=#c0c0c0 bordercolordark=#FFFFFF>
<tr align=center>
<td>社区共有 <b><%=allbattlemsg%></b> 条竞技短消息，已读 <b><%=readbattlemsg%></b> 条，未读 <b><%=allbattlemsg-readbattlemsg%></b> 条。</td>
</tr>
<tr align=center>
<td>
    <input type="button" value="删除已读竞技短消息" name="title" class=fmbtn onclick="javascript:window.location='pet_config_edit.asp?action=delreadbattlemsg';">
    <input type="button" value="删除所有竞技短消息" name="title" class=fmbtn onclick="javascript:window.location='pet_config_edit.asp?action=delallbattlemsg';">
</td>
</tr>
</table>
</div>
<%end if%>

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

	</td></tr></table>
<% If GBL_TableBottomString <> "" Then %><table width=<%=DEF_BBS_ScreenWidth%> border=0 cellspacing=0 cellpadding=0 align=center><tr><td><%=GBL_TableBottomString%></td></tr></table><% End If %>
<%    
end if

SiteBottom 
If GBL_SiteBottomString <> "" Then Response.Write GBL_SiteBottomString
%>