<%@ Language=VBScript%>
<%
Response.Buffer=false
Response.Expires=0
%>
<!-- #include file="../dsn.asp" -->
<!-- #include file="../links.asp" -->
<%
if session("adminusername")="" then
		Response.Redirect linkwarn
end if
showok=Request.QueryString ("showok")
pid=Request.QueryString("pid")
id=Request.QueryString("id")
ppid=Request.QueryString("ppid")
pageno=Request.QueryString("pageno")
mode=Request.QueryString ("mode")
htmlname="user_list_web.asp?ppid="&ppid&"&pid="&pid
'addhtml="user_list_web.asp?ppid="&ppid&"&pid="&pid&"&showok=1"
if id="" then
		id=0
	else	
		id=cint(id)	
	
end if
if pid="" then
		pid=0
	else	
		pid=cint(pid)	
	
end if
if showok="" then
		showok=0
	else	
		showok=cint(showok)	
end if
if ppid="" then
		ppid=0
	else
		ppid=int(ppid)
end if		
plflag=Request.QueryString ("plflag")
pl1=Request.QueryString ("pl")
if pl1="" or pl1=1 then pl1=1
if pl1=1 then 
		pl1=9
	else
		pl1=1
end if 
if plflag="" then plflag="id"
set cn=Server.CreateObject("ADODB.Connection")
cn.Open mycnstr
set rs=server.CreateObject("ADODB.Recordset")
set rs1=server.CreateObject("ADODB.Recordset")
set rs2=server.CreateObject("ADODB.Recordset")
if ppid<>0 then
		sqltext="select title from scool where id="&ppid
		rs1.Open sqltext,cn,1,1
		if not rs1.EOF then
				bbs_p_scoolname=rs1("title")
		end if
		rs1.Close 
end if
if pid<>0 then
		sqltext="select title from classes where id="&pid
		rs1.Open sqltext,cn,1,1
		if not rs1.EOF then
				bbs_p_classesname=rs1("title")
		end if
		rs1.Close 
end if
htmltitle="基本数据管理"
txtname="会员管理"
tabname="userbase"
if id<>0 then
	sqltext="select * from "+tabname+" where id="&id
	rs.Open sqltext,cn,1,1
	if not rs.EOF then
		username=trim(rs("username"))
		userpass=rs("password")
		enable=rs("enable")
		creatdate=rs("creatdate")
		usertel=trim(rs("usertel"))
		namecn=rs("namecn")
		usertel=rs("usertel")
		email=trim(rs("email"))
		adminflag=rs("flag")
	end if
	rs.Close 
else
	enable=1	
end if
if Request.ServerVariables("REQUEST_METHOD")="POST" and mode<>"888" then
		if not isempty(request("sel")) then
     		idlist=request("sel")
     		if instr(idlist,",")>0 then
				dim idarr
				idArr=split(idlist)
				for i = 0 to ubound(idarr)
	       			delid=clng(idarr(i))
	       			call setupdate(delid,mode)
				next
			else
				delid=clng(idlist)
				call setupdate(delid,mode)
			end if	
		end if
		delid=0
		Response.Redirect htmlname
end if
  sub setupdate(id,mm)
    if mm="999" then
		sqltext3="delete from "+tabname+" where id="&id
		cn.Execute sqltext3 
		
	elseif  mm="777" then
		sqltext3="update "+tabname+" set enable=1 where id="&id
		cn.Execute sqltext3
	elseif  mm="666" then
		sqltext3="update "+tabname+" set enable=0 where id="&id
		cn.Execute sqltext3
	end if	
  end sub
%>
<html>
<head>
<title><%=htmltitle%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {font-size: 12px; color: #000000; font-family: 宋体}
td {font-size: 12px; color: #000000; font-family: 宋体;line-height:130%}
.t1 {font:12px 宋体;color=000000} 
.t2 {font:12px 宋体;color:ffffff} 
.t3 {font:12px 宋体;color:336699} 
.t4 {font:12px 宋体;color:ff0000} 
.t5 {font:12px 宋体;color:ff6600} 


.bt1 {font:14px 宋体;color=000000} 
.bt2 {font:12px 宋体;color:ffffff} 
.bt3 {font:14px 宋体;color:336699} 
.bt4 {font:14px 宋体;color:ff0000} 
.bt5 {font:14px 宋体;color:0000ff}
.bt10 {font:14px 宋体;color:0000ff}

.td1 {font-size:12px;background-color:#3388bb;color:#ffffff}
.td2 {font-size:12px;background-color:#ffffff;color:#000000;}

A:link {color: #000077}
A:visited {color: #000077}
A:hover {color: #ff0000}

A.r1:link {text-decoration:none;color:#304556;}
A.r1:visited {text-decoration:none;color:#304556;}
A.r1:hover {text-decoration:underline;color:ff6600;}

A.r2:link {text-decoration:none;color:#ffffff;}
A.r2:visited {text-decoration:none;color:#ffffff;}
A.r2:hover {text-decoration:underline;color:cccc00;}

-->
</style>
</head>
<body topmargin=5>
<table width="100%" align=center>
	<tr>
	<td valign="top" align="left" width="100%">
		<table width="100%" height="20" border="0">
			<tr>
			<td style="font-size:12px;"></td>
			<td><font class="t5">当前位置： <%Response.Write (bbs_p_scoolname)%>→  <%Response.Write (bbs_p_classesname)%>(列表)</font>
			</td>
			<td align="right">
			</td>
			</tr>
			</table>
			</td>
			</tr>
			</table>
       <table width="100%" border="0" cellspacing="1" cellpadding="1" style="font-size:14.5px;line-height:100%" valign=top>
        <tr><td height=280 valign=top>		
		<table width="100%" height="20" border="0">
			<form action="<%=htmlname%>" method=post name="listform">
			<tr>
		<%
			sqltext1="select * from "+tabname+" order by id"
			listcs=20
			rs1.Open sqltext1,cn,1,1
			rs1.PageSize=listcs
			if pageno="" then 
				pageno=1
			else
				pageno=cint(pageno)	
			end if	
			if rs1.PageCount>0 then rs1.AbsolutePage=pageno
			
			%>
			<td class=t1 align="left" width=340>
			<a href="Javascript:window.location.reload()">[刷新列表]</a>
			<a href="javascript:delrows()">[删除]</a>
			<a href="javascript:shows()">[有效]</a>
			<a href="javascript:noshows()">[无效]</a>
		</td>
		<td align="right">
		<%if rs1.PageCount>1 then%>
			[第<b><font color=ff6600><%=pageno%></font></b>页, 共<b><font color=ff6600><%=rs1.PageCount%></font></b>页<b><font color=ff6600><%=rs1.RecordCount%></font></b>条记录		              	
			<%if pageno>1 then%>
				<a class=r href="<%=htmlname%>&pageno=1">首页</a>              
				<a class=r href="<%=htmlname%>&pageno=<%=pageno-1%>">上页</a>              
			<%end if              
			if pageno<rs1.PageCount then%>              
				<a class=r href="<%=htmlname%>&pageno=<%=pageno+1%>">下页</a>              
				<a class=r href="<%=htmlname%>&pageno=<%=rs1.PageCount%>">末页</a>              
			<%end if%>              
		<%end if              
		%>              
		</td></tr>
		</table>
		<table width="100%" border="0" cellspacing="1" cellpadding="1" style="font-size:14.5px;line-height:100%">
			<tr bgcolor="666699" style="color:#ffffff" align="center">
				<td class=bt2>&nbsp;</td>
			    <td class=bt2><a href="<%=htmlname%>&plflag=enable&pl=<%=pl1%>"><font color="#ffffff">是否有效</a></td>	
			    <td class=bt2><a href="<%=htmlname%>&plflag=user_name&pl=<%=pl1%>"><font color="#ffffff"><%=txtname%></a></td>
				<td class=bt2><a href="<%=htmlname%>&plflag=namecn&pl=<%=pl1%>"><font color="#ffffff">真实姓名</font></a></td>
				<td class=bt2><a href="<%=htmlname%>&plflag=login_count&pl=<%=pl1%>"><font color="#ffffff">登录次数</a></td>
				<td class=bt2><a href="<%=htmlname%>&plflag=login_last_date&pl=<%=pl1%>"><font color="#ffffff">上次登录时间</a></td>
				<td class=bt2><a href="<%=htmlname%>&plflag=login_last_ip&pl=<%=pl1%>"><font color="#ffffff">上次登录IP</a></td>
			</tr>
		<%
		i=0
		do while not rs1.EOF and i<listcs 
			if (i mod 2)=1 then
				Response.Write("<tr bgcolor=fefefe>")
			else
				Response.Write("<tr bgcolor=efefef>")
			end if	
		%>
		
		<td width="20" align="center"><input type="checkbox" name="sel" value="<%=(rs1("id"))%>"></td>
		<td width="70" align="center">
			<%if rs1("enable")=1 then 
				Response.Write "有效"
		    else
				Response.Write "<font color=red>无效</font>"
			end if%>
		</td>
		<td align=left><a href="Javascript:userinfo('<%=rs1("username")%>','<%=rs1("flag")%>')"><%=trim(rs1("username"))%></a></td>
		<td align=center width=180><%=rs1("namecn")%></td>
		<td align=center width=120><%=rs1("logincount")%></td>
		<td width="120" align="center"><%=rs1("loginlast")%></td>
		<td width="100" align="center"><%=rs1("loginlastip")%></td>
		</tr>
	    <%rs1.MoveNext 
			i=i+1
	    loop
	    rs1.Close 
	    %>
	    </form>
		</table>	
		</td></tr></table>
	  </td></tr>
	 </table>	
</body>
</html>
<script language="Javascript">

    function delrows()
    {
        if (confirm('您确认要删除你所选中的项目吗？')==true)
        {        
        document.listform.action="<%=htmlname%>&mode=999";
        document.listform.submit();
        }
    }
    function shows()
    {
		listform.action="<%=htmlname%>&mode=777";
        document.listform.submit();
    }
    function noshows()
    {
        document.listform.action="<%=htmlname%>&mode=666";
        document.listform.submit();
    }
   function userinfo(userno,userflag)
   {
	 window.open("../user/user_txt.asp?userno="+userno+"&userflag="+userflag,"","toolbar=no,location=no,directories=no,status=no,resizable=no,menubar=no,scrollbars=auto,width=420,height=310,left=120,top=70")
	 
   }	
</script>
