<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<%
if session("admin")="" then
  response.redirect "admin_login.asp"
end if

'03 联盟作者管理
if not checkflag("03") then
  call mb("对不起，您没有联盟作者管理的权限！","",0)
end if

dim action
dim totalpage,maxperpage,totalrecords,i,currentpage
action=request("action")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>作者管理相关</title>
<script language=javascript src="mouse_up.js"></script>
<link href="admin.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="5" topmargin="0">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" bgcolor="#000000" vspace="0" hspace="0">
  <tr bgcolor="#EFEBEF">
    <td height="27"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="86%"><font color="#FF3000">.:: 您可以在这里进行[作者管理]相关操作</font></td>
          <td width="14%" height="20" align="center"><a href="javascript:this.location.reload()"><img src="images/refresh.gif" alt="刷新" width="40" height="12" border="0"></a></td>
        </tr>
      </table></td>
  </tr>
  <tr > 
    <td height="1" bgcolor="#000000"></td>
  </tr>
</table>
<%
select case action
  case "count"
    call countzp() 
  case else
    call main()
end select

sub countzp()

dim username,flashnum:username=request("username")

if username="" then
  call mb("请指定要重新统计作品数的用户！","",0)
end if

set rs=conn.execute("select count(id) from flash where username='"&username&"'")

if rs.bof and rs.eof then
  flashnum=0
else
  flashnum=rs(0)
end if
rs.close
set rs=nothing
conn.execute("update author set flashnum="&flashnum&" where username='"&username&"'")
call mb("经统计该作者共有作品数："&flashnum,"admin_author.asp",1)

end sub

sub main()

response.expires=0
currentpage=request("page")
if not isinteger(currentpage) then
  currentpage=1
else
  currentpage=clng(currentpage)
end if

maxperpage=20
totalrecords=0
totalpage=1
i=1

set rs=server.createobject("adodb.recordset")
sql="select * from author order by userid desc"
rs.open sql,conn,1,1

if not(rs.bof and rs.eof) then
  rs.pagesize=maxperpage
  rs.absolutepage=currentpage
  totalpage=rs.pagecount
  totalrecords=rs.recordcount
end if
%>
<br>
<br>

<table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  <tr align="center" bgcolor="#EFEBEF"> 
    <td width="3%" height="23" bgcolor="#EFEBEF"><font color="#000000">ID</font></td>
    <td width="15%" height="20" bgcolor="#EFEBEF"><font color="#000000">登陆帐号</font></td>
    <td width="17%" height="20" bgcolor="#EFEBEF"><font color="#000000">登陆密码</font></td>
    <td width="24%"><font color="#000000">电子邮件</font></td>
    <td width="9%" height="20"><font color="#000000">作品数</font></td>
    <td width="14%" height="20"><font color="#000000">注册日期</font></td>
    <td width="18%" height="20"><font color="#000000">操　作</font></td>
  </tr>
  <%do until rs.eof or i>maxperpage%>
  <tr bgcolor="#FFFFFF"> 
    <td height="20">&nbsp;<%=rs("userid")%></td>
    <td height="20">&nbsp;<a href="showuser.asp?username=<%=rs("username")%>" title="查看作者：<%=rs("username")%> 的详细信息..." target=_blank><%=rs("username")%></a></td>
    <td height="20">&nbsp;<%=rs("password")%></td>
    <td>&nbsp;<a href="mailto:<%=rs("email")%>"><%=rs("email")%></a></td>
    <td height="20">&nbsp;<%=rs("flashnum")%></td>
    <td height="20">&nbsp;<%=formatdatetime(rs("dateandtime"),2)%></td>
    <td height="20" align="center">&nbsp;<a href="?action=count&username=<%=rs("username")%>" title='统计作者：<%=rs("username")%>的作品数...'>统计作品</a> 
      <a href="admin_authoredit.asp?username=<%=rs("username")%>" title="编辑作者：<%=rs("username")%> 的信息..">编辑</a> 
      <a href="admin_authordel.asp?username=<%=rs("username")%>" title="删除作者：<%=rs("username")%> 的信息..." onclick="javascript:if(confirm('是否真的要删除作者：<%=rs("username")%>吗？\n\n系统提示：这将连同删除作者发布的作品，删除后不可恢复！')){return true;}else{return false;}">删除</a></td>
  </tr>
  <%rs.movenext
   i=i+1
   loop
  %>
  <tr bgcolor="#FFFFFF"> 
    <td height="20" colspan="7"> 
      <%if totalrecords>0 then call showpage("admin_author.asp",totalrecords,maxperpage,true,true,"名作者")%>
    </td>
  </tr>
</table>
<%
rs.close
set rs=nothing
end sub
%>
</body>
</html>
