<!-- #Include File="Include/AMH_onlogin.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V2.0》，简称“AsaiMHV2”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

Index_Url="data"
call AMH_master(0,0)
Call AMH_Header(1)
%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a href='?'><%Response.Write tit%></a></td>
  <td width=10></td>
  <td><a href='?action=update'>网站统计数据更新</a></td>
  <td width=10></td>
  <td><a href='?action=cache'>网站缓存清理</a></td>
  </tr>
  </table>
</td></tr>
</table>
<%
call AMH_table(1)
select case action
case "update"
  call AsaiMHChk_Update()
case "cache"
  call AsaiMHChk_cache()
case else
  call AsaiMHChk_Main()
end select
Call AMH_Ender(tit)

sub AsaiMHChk_Update()
dim Counter,Max_Online,Num_Reg,Start_Tim,Max_Tim,New_Username,Num_New
  call AMH_td("网站统计数据更新")
  sql="select * from AsaiMHConfigs where id=1"
  Call Cls.Exe_Conn(Rs,SQL,3)
  if rs.eof then
    rs.close
    call AMH_msg(tit_fir&"ID（"&id&"）不存在！","?",1)
    exit sub
  End If
  if chk() then
	Counter=Cls.Code_Int("Counter",1)
	Max_Online=Cls.Code_Admin("Max_Online",1,100)
	Num_Reg=Cls.Code_Admin("Num_Reg",1,100)
	Start_Tim=Cls.Code_Admin("Start_Tim",1,100)
	Max_Tim=Cls.Code_Admin("Max_Tim",1,100)
	New_Username=Cls.Code_Admin("New_Username",1,100)
	Num_New=Cls.Code_Admin("Num_New",1,100)
	if Counter="" or Max_Online="" then
		rs.close
		call AMH_error(tit_fir&"标题 和 "&tit_fir&"内容 不能为空！")
		exit sub
	End If
	rs("Counter")=Counter
	rs("Max_Online")=Max_Online
	rs("Num_Reg")=Num_Reg
	rs("Start_Tim")=Start_Tim
	rs("Max_Tim")=Max_Tim
	rs("New_Username")=New_Username
	rs("Num_New")=Num_New
	rs.update
	rs.close
	Call Cls.Cache_Del("Web_Info")
	call AMH_msg("成功重新计算了整个网站的统计信息！","?action="&action,1)
	exit sub
  End If
  call form_first()
%>
<form name=add_frm action='?action=<%=action%>' method=post>
<input type=hidden name="chk" value="yes">
<tr>
<td width='20%'>操作注意事项：</td>
<td width='80%' class=htd>建议在数据显示错乱时执行本次操作。</td>
</tr>
<tr class=tr>
<td>网站计数：</td>
<td> <input type=text class=txt name=counter value="<%Response.Write rs("Counter")%>" size=10 maxlength=20> 人次</td>
</tr>
<tr class=tr>
<td>建站时间：</td>
<td><input type=text class=txt name=start_tim value="<%Response.Write rs("start_tim")%>" size=20 maxlength=50> </td>
</tr>
<tr class=tre>
<td>最高在线：</td>
<td><input type=text class=txt name=max_online value="<%Response.Write rs("max_online")%>" size=10 maxlength=20> 人</td>
</tr>
<tr class=tre>
<td>最高在线时间：</td>
<td><input type=text class=txt name=max_tim value="<%Response.Write rs("max_tim")%>" size=20 maxlength=20></td>
</tr>
<tr class=tr>
<td>注册人数：</td>
<td><input type=text class=txt name=num_reg value="<%Response.Write rs("num_reg")%>" size=10 maxlength=20> 人</td>
</tr>
<tr class=tr>
<td>最新注册用户：</td>
<td><input type=text class=txt name=new_username value="<%Response.Write rs("new_username")%>" size=20 maxlength=50></td>
</tr>
<tr class=tr>
<td>今日贴数：</td>
<td><input type=text class=txt name=num_new value="<%Response.Write rs("num_new")%>" size=10 maxlength=20> 贴</td>
</tr>
<tr class=tre>
<td>统计数据：</td>
<td><font class=red2>重新计算整个网站的统计信息！</font></td>
</tr>
<tr><td height=40 colspan=2 align=center><input type=submit value='网站统计数据更新' class=btn></td></tr>
<%
rs.close
  num_reg=0
  new_username=""
  set rs=Cls.exec("select count(id) from AsaiMHUserdata",1)
  if not rs.eof then num_reg=rs(0)
  rs.close
  set rs=Cls.exec("select top 1 username from AsaiMHUserdata order by id desc",1)
  if not rs.eof then new_username=rs(0)
  rs.close
  'if not Cls.Is_Int(num_new) then num_new=0
  'sql="update AsaiMHconfigs set num_reg="&num_reg&",new_username='"&new_username&"',num_new="&num_new&",today_tim='"&Cls.time_type(Cls.now_time,4)&"'"
  sql="update AsaiMHconfigs set num_reg="&num_reg&",new_username='"&new_username&"',today_tim='"&Cls.time_type(Cls.now_time,4)&"'"
  call Cls.exec(sql,0)
End Sub

sub AsaiMHChk_cache_1()
  dim aaa
  if Cls.Code_Query("chk")<>"yes" then
    call AMH_td("网站缓存清理")
%>
<tr>
<td>操作注意事项：</td>
<td height=60 class=htd>现在正在执行清理网站当前正在使用的所有缓存！<br />建议在数据显示错乱时执行本次操作。</td>
</tr>
<tr><td height=40 colspan=2 align=center><input type=button value='执行网站缓存清理' onclick="javascript:location.href='?action=<%Response.Write action%>&chk=yes';"></td></tr>
<%
    exit sub
  End If
  sql="select sum(bbs_new_num) from bbs_Bbs where bbs_star=0"
  set rs=Cls.exec(sql,1)
  aaa=rs(0)
  rs.close
  if not Cls.Is_int(aaa) then aaa=0
  call Cls.exec("update configs set num_new="&aaa,0)
  Cls.Cahce_Delete()
  call AMH_msg("成功对网站现在所使用的所有缓存进行了清理！","?action="&action,1)
End Sub
sub AsaiMHChk_cache()
  dim aaa
  if Cls.code_query("chk")<>"yes" then
    call AMH_td("网站缓存清理")
%>
<form name=app_frm action='?action=<%response.write action%>&chk=yes' method=post>
<tr>
<td>现有的网站缓存：</td>
<td>
  <table border=0>
  <tr><td><input type=checkbox name=app_all value='yes'><b>网站所有缓存</b></td></tr>
  <tr>
  <td><input type=checkbox name=app_name value='online_num'>网站当前在线</td>
  <td><input type=checkbox name=app_name value='tim_space'>在线时间间隔</td>
  </tr>
  <tr>
  <td><input type=checkbox name=app_name value='config'>网站配置</td>
  <td><input type=checkbox name=app_name value='group'>网站用户组</td>
  </tr>
  <tr>
  <td><input type=checkbox name=app_name value='skin'>网站SKIN</td>
  <td><input type=checkbox name=app_name value='cast'>网站公告</td>
  </tr>
  <tr>
  <td><input type=checkbox name=app_name value='menu'>网站菜单</td>
  <td><input type=checkbox name=app_name value='nsort'>频道分类</td>
  </tr>
  <tr>
  <td><input type=checkbox name=app_name value='bbs_class'>论坛分类</td>
  <td><input type=checkbox name=app_name value='bbs_grade'>论坛导航</td>
  </tr>
  <tr>
  <td><input type=checkbox name=app_name value='bbs_istops'>论坛总固顶</td>
  <td><input type=checkbox name=app_name value='bbs_istop_'>论坛固顶</td>
  </tr>
  </table>
</td>
<tr>
<td>操作注意事项：</td>
<td height=60 class=htd>现在正在执行清理网站当前正在使用的所有缓存！<br />建议在数据显示错乱时执行本次操作。</td>
</tr>
<tr class=trb><td colspan=2 align=center><input type=submit value='执行网站缓存清理' class=btn></td></tr>
</form>
<%
    exit sub
  end if
  dim app_name,app_all
  app_name=Cls.code_form("app_name")
  app_all=Cls.code_form("app_all")
  sql="select sum(bbs_new_num) from AsaiMHBbsClass where bbs_star=0"
  set rs=Cls.exec(sql,1)
  aaa=rs(0)
  rs.close
  if not Cls.is_int(aaa) then aaa=0
  call Cls.exec("update AsaiMHconfigs set num_new="&aaa,0)
  if app_all="yes" then
    call Cls.cache_delete()
  else
    app_name=replace(app_name," ","")
    if app_name<>"" then
      app_name=split(app_name,",")
      for i=0 to ubound(app_name)
        if app_name(i)="config" then
          call Cls.cache_del("web_dim")
        end if
        call Cls.cache_del(app_name(i))
      next
      erase app_name
    end if
  end if
  call AMH_msg("成功对网站现在所使用的所有缓存进行了清理！","?action="&action,1)
end sub
sub AsaiMHChk_Main()
  call AMH_td(tit)
%>
<tr>
<td width='20%'></td>
<td width='80%'>
  <table border=0>
  <tr><td><%Response.Write img_admin("","")%>&nbsp;<a href='?action=update'>网站统计数据更新</a></td></tr>
  <tr><td>重新计算整个网站的统计信息!。</td></tr>
  </table>
</td>
</tr>
<tr>
<td></td>
<td>
  <table border=0>
  <tr><td><%Response.Write img_admin("","")%>&nbsp;<a href='?action=cache'>网站缓存清理</a></td></tr>
  <tr><td>清理网站当前正在使用的所有缓存！建议在数据显示错乱时执行本次操作。</td></tr>
  </table>
</td>
</tr>
<%
End Sub
%>
