<!--#include file="sdcms_check.asp"-->
<%
set sdcms=new Sdcms_Admin
sdcms.Check_admin
sdcms.Check_lever 13
set sdcms=nothing
select case action
case else:title="日志管理"
end select
sd_table="sd_log"
sdcms_head
%>
<div class="sdcms_notice"><span>管理操作：</span><a href="?">日志管理</a></div>
<br>
<ul id="sdcms_sub_title">
	<li class="sub"><%=title%></li><li class="unsub"><a href="?action=del_all" onclick='return confirm("真的要删除?不可恢复!\n2天内的将会被保留!");'>清空日志</a></li>
</ul>
<div id="sdcms_right_b">
<%
select case action
case "del":del
case "del_all":del_all
case else:main
end select
closedb
sub main
%>
  <table border="0" align="center" cellpadding="3" cellspacing="1" class="table_b">
    <form name="add" action="?" method="post"  onSubmit="return confirm('真的要删除?不可恢复!\n2天内的将会被保留!');">
	<tr>
	<td class="title_bg">选择</td>
      <td width="50" class="title_bg">ID</td>
      <td class="title_bg">帐户</td>
	  <td class="title_bg">操作</td>
      <td class="title_bg">IP</td>
      <td class="title_bg">日期</td>
      <td class="title_bg">管理</td>
    </tr>
	<%
	page=request.querystring("page")
	if page="" or not isnumeric(page) then
	page=1
	end if
	pages = 20
	set rs=server.CreateObject("adodb.recordset")
	sql="select id,sdcms_name,content,ip,adddate from "&sd_table&" order by id desc"
	rs.open sql,conn,1,1	
	if rs.eof then
	else
	rs.pagesize = pages
	maxpagecount=rs.pagecount
	rs.absolutepage = page 
	rcount1=0
	pagestart=page-5
	pageend=page+5
	if pagestart<1 then
	pagestart=1
	end if
	if pageend>maxpagecount then
	pageend=maxpagecount
	end if
	rcount=rs.RecordCount
	do while not rs.eof and rcount1 <rs.pagesize  
	%>
    <tr onmouseover=this.bgColor='#EBFFDC'; onmouseout=this.bgColor='#ffffff';  bgcolor='#ffffff'>
	<td align="center"><input name="id"  type="checkbox" onClick="unselectall()"   value="<%=rs(0)%>"></td>
	 <%for i=0 to 4%>
      <td <%if i<>2 then%>align="center"<%end if%>><%=rs(i)%></td>
      <%next%>
      <td align="center"><a href="?action=del&id=<%=rs(0)%>" onclick='return confirm("真的要删除?不可恢复!\n2天内的将会被保留!");'>删除</a></td>
    </tr>
	<%
	rs.movenext
	rcount1=rcount1+1
	loop
	end if         
	%>
	<tr>
      <td colspan="7" class="tdbg" >
	  <span class="right">转到第
		 <select onChange="location.href='?page='+this.value+''">
		 <%for i=1 to maxpagecount%>
		 <option value="<%=i%>" <%if clng(page)=clng(i) then echo "selected" end if%>><%=i%></option>
		 <%next%>
		 </select>页</span>　<input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox"> 全选 
              <select name="action">
			  <option>→操作</option>
			  <option value="del">删除</option>
			  </select> 
             
      <input type="submit" class="bnt" value="执 行">

</td>
    </tr>
	<tr>
      <td colspan="7" class="tdbg" align="center">
	  
<%
if page<>"1" then
echo "<a href=?page="&page-1&">上一页</a> "
else
echo "上一页 "
end if
for i=pagestart to pageend
if i=0 then 
i=1
end if
if i=clng(page) then
str="<font color=red><b>"&i&"</b></font>"
else
str=i
end if
strurl="[<a href=?page="&i&">"&str&"</a>]"
echo strurl
next
if page=maxpagecount then
echo " 下一页"
elseif  page<>""&maxpagecount&"" then
echo " <a href=?page="&page+1&"&stype="&stype&"&classid="&classid&">下一页</a>"
else
echo " 下一页"
end if
echo " 页次:"&page&"/"&maxpagecount&" 页   每页: "&pages&" 条  总数: "&rcount&" 条"
%>
</td>
    </tr>
	</form>
  </table>
<%
end sub

sub del
if id<>"" then
if instr(id,", ")>0 then
	id=split(id,", ")
		for i=0 to ubound(id)
		  conn.execute("delete from "&sd_table&" where id="&id(i)&" and adddate<(date()-2)")
		Next
Else
	conn.execute("delete from "&sd_table&" where id="&id&" and adddate<(date()-2)")
End if
End if
  response.Redirect("?")
end sub

sub del_all
  conn.execute("delete from "&sd_table&" where adddate<(date()-2)")
  response.Redirect("?")
end sub
%>  
</div>
</body>
</html>