<!--#include file="conn.asp"-->
<!--#include file="user_chkpass.asp"-->
<!--#include file="inc/function.asp"-->
<%
if CheckUserLogined()=False then
	response.Redirect "user_login.asp"
end if
%>
<link href="Admin_STYLE.CSS" rel="stylesheet" type="text/css"> 
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor">
<%
dim action
action=request.QueryString("action")
select case action
	case "addotheruser"
		call addotheruser()
	case "del"
		call delotheruser()
	case else
		call main
end select

sub addotheruser()
	dim otheruser,rs
	otheruser=Trim(Request.Form("otheruser"))
	If otheruser="" Then
		Response.Write("<script language=javascript>alert('名称不能为空！');window.location.replace('user_blogteam.asp')</script>")
		Response.End()
	End If	 
	set rs=conn.execute("select en_blogteam from [user] where username='"&otheruser&"'")
	if rs.eof then
		Response.Write("<script language=javascript>alert('无此用户！');window.history.go(-1)</script>")
		Response.End()
	else
		if rs(0)<>"true" then
			Response.Write("<script language=javascript>alert('该用户设置为不允许被加入团队！');window.history.go(-1)</script>")
			Response.End()
		end if		
	end if
	conn.execute("insert into [blogteam] (mainuser,otheruser) values ('"&username&"','"&otheruser&"')")
	set rs=nothing
	call closeconn()
    response.Redirect "user_blogteam.asp"
end sub

sub delotheruser
	dim id
	id=clng(request.QueryString("id"))
   conn.execute("delete  from [blogteam] where id="&id)
    response.Redirect "user_blogteam.asp"
end sub



sub main()
%>
<br>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
  <tr valign="middle"> 
    <td height="21" colspan="3" class="topbg">
<div align="center"><strong>邀请朋友到我的博客团队</strong></div></td>
  </tr>
   <tr class="tdbg"><form name="form1" method="post" action="user_blogteam.asp?action=addotheruser">
          <td height="20" colspan="3"><div align="center">用户ID： 
          <input name="otheruser" type="text" id="otheruser" maxlength="20">
            
          <input type="submit" name="Submit" value="邀请">			             
          </div></td></form>
  </tr>
</table>
		
<br>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
        <tr class="topbg" height="25">
          <td width="100" >        <div align="center">排序</div></td>
          <td width="200">        <div align="center">团队成员</div></td>
          <td>          <div align="center">管理操作</div></td>
		  </tr>
<%
dim rs,i
set rs=conn.execute("select * from blogteam where mainuser='"&username&"'")
while not rs.eof
	i=i+1 
%>
  <tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'"> 
  <td > <div align="center"><%=i%></div></td>
    <td><div align="center"><%=rs("otheruser")%></div></td>
    <td><div align="center"><a href="user_blogteam.asp?action=del&id=<%=rs("id")%>" <%="onClick='return confirm(""删除后，此成员所有日志将不会在你的blog中显示,确定要删除吗？"");'"%>>删除此博客成员</a></div></td></tr>
<%
rs.movenext
wend 
%>
</table>
<br>
<br>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
  <tr valign="middle"> 
    <td height="21" class="topbg"> <div align="center"><strong>我加入的博客团队</strong></div></td>
  </tr>
</table>
<br>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
  <tr class="topbg" height="25"> 
    <td width="100" > <div align="center">排序</div></td>
    <td width="201"> <div align="center">BLOG名</div></td>
    <td width="95">BLOG主人</td>
    <td width="367"> <div align="center">管理操作</div></td>
  </tr>
  <%
set rs=conn.execute("select blogteam.id,blogteam.mainuser,[user].blogname from blogteam,[user] where otheruser='"&username&"' and [user].username=blogteam.mainuser")
i=0
while not rs.eof
	i=i+1 
%>
  <tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'"> 
    <td > <div align="center"><%=i%></div></td>
    <td><div align="center"><a href=blog.asp?name=<%=rs(1)%> target="_blank"><%=rs(2)%></a></div></td>
    <td><div align="center"><a href=blog.asp?name=<%=rs(1)%> target="_blank"><%=rs(1)%></a></div></td>
    <td><div align="center"><a href="user_blogteam.asp?action=del&id=<%=rs("id")%>" <%="onClick='return confirm(""确认退出吗？"");'"%>>退出此博客团队</a></div></td>
  </tr>
  <%
rs.movenext
wend 
set rs=nothing
call closeconn()
%>
</table>
<br>
<%
end sub
%>
</body>

