<!--#include file="chklogin.asp"-->
<!--#include file="../conn.asp"-->
<!--#include file="../md5.asp"-->
<!--#include file="../dengji.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>快问我知道 - 专家管理</title>
<link href="css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	background-color: #FF9999;
	scrollbar-face-color: #FF3333;
        scrollbar-highlight-color: #FFFFFF;
}
-->
</style>
        <%
		dim rs,sql
		set rs=server.CreateObject("adodb.recordset")
		sql ="Select * from kw_xl"
        rs.open sql,conn,1,1
		%>
<SCRIPT language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();

        <%
        count = 0
        do while not rs.eof 
        %>
subcat[<%=count%>] = new Array("<%=rs("xiaolei")%>","<%=rs("dalei")%>","<%=rs("xiaolei")%>");
        <%
        count = count + 1
        rs.movenext
        loop
        rs.close
        %>
onecount=<%=count%>;

function changelocation(locationid)
    {
    document.myform.xl.length = 0; 
    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.myform.xl.options[document.myform.xl.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
        
    }    
</SCRIPT>
</head>
<body bgcolor="#FF9999"><br>
<br>
<br>
<%
Response.Buffer = True 
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1 
Response.Expires = 0 
Response.CacheControl = "no-cache"

if session("userflag")="编辑管理员" then
response.Write("&nbsp;&nbsp;&nbsp;&nbsp;你没有权限进行此项操作！")
response.End()
end if

dim action,id
dim i,username
action=request.QueryString("action")
id=request.QueryString("id")
if action="sc" then
sc
elseif action="xg" then
xg
elseif action="tj" then
tj
elseif action="1" then
zhuan1
elseif action="2" then
zhuan2
end if

sub zhuan1()
dim rs,sql
set rs=server.CreateObject("adodb.recordset")
sql="select * from kw_user where id="&id
rs.open sql,conn,1,3
rs("zhuan")=1
rs.update
rs.close
set rs=nothing
response.write "<script language=javascript>alert('设定专家成功！');history.go(-1);</script>"
response.End
end sub

sub zhuan2()
dim rs,sql
set rs=server.CreateObject("adodb.recordset")
sql="select * from kw_user where id="&id
rs.open sql,conn,1,3
rs("zhuan")=0
rs.update
rs.close
set rs=nothing
response.write "<script language=javascript>alert('取消专家成功！');history.go(-1);</script>"
response.End
end sub

sub tj()
dim rs,sql
set rs=server.CreateObject("adodb.recordset")
sql="select * from kw_user"
rs.open sql,conn,1,3
rs.addnew
rs("username")=request.Form("zhuanjia")
rs("userpassword")=md5("8888",16)
rs("zhuan_dl")=request.Form("dl")
rs("zhuan_xl")=request.Form("xl")
rs("regtime")=now()
rs("dengji")=dengji1
rs("zhuan")=1
rs("jifen")=50
rs.update
rs.close
set rs=nothing
response.write "<script language=javascript>alert('添加专家成功！');history.go(-1);</script>"
response.End
end sub

sub sc()
sql="delete from kw_user where id="&id
conn.execute sql
response.write "<script language=javascript>alert('成功的删除了用户');history.go(-1);</script>"
response.End
end sub

sub xg()
zhuan_dl=request.Form("zhuan_dl")
zhuan_xl=request.Form("zhuan_xl")
set rs=server.CreateObject("adodb.recordset")
sql="select zhuan_dl,zhuan_xl from kw_user where id="&id
rs.open sql,conn,1,3
rs("zhuan_dl")=zhuan_dl
rs("zhuan_xl")=zhuan_xl
rs.update
response.write "<script language=javascript>alert('修改成功');document.location.href='zhuan.asp'</script>"
response.End
end sub

username=request("username")
set rs=server.CreateObject("adodb.recordset")
if username<>"" then
sql="select * from kw_user where username='"&username&"' and zhuan=1"
else
sql="select * from kw_user where zhuan=1 order by id desc"
end if
rs.open sql,conn,1,3
%>
<table width="680" border="0" align="center" cellpadding="0" cellspacing="1" class="tablebg">
  <tr align="center" bgcolor="#ff6666">
    <td colspan="5" class="font_bt">注 册 用 户 管 理</td>
  </tr>
  <tr align="center" bgcolor="#ff6666">
    <form action="zhuan.asp" method="post">
	<td height="30" colspan="5">
	查找专家(用户全部ID)：&nbsp;&nbsp;&nbsp;&nbsp;
	<input name="username" type="text">&nbsp;&nbsp;<input name="submit" type="submit" id="submit" value="查 找">
    </td>
    </form>
  </tr>
  <tr bgcolor="#ff6666">
    <form action="zhuan.asp?action=tj" method="post" name="myform">
    <td height="40" colspan="5">&nbsp;<b>添加专家：</b>&nbsp;&nbsp;
    <input name="zhuanjia" type="text" id="zhuanjia" size="18">
    &nbsp;&nbsp;
	所属大类：<select name="dl" onChange="changelocation(document.myform.dl.options[document.myform.dl.selectedIndex].value)">
            <OPTION selected value="">==请选类型==</OPTION>
		<%
		dim rs4,sql4,i4
		set rs4=server.CreateObject("adodb.recordset")
		sql4 ="Select * from kw_dl order by dldm"
        rs4.open sql4,conn,1,1
		for i4=1 to rs.recordcount
		%>
		<OPTION value="<%=rs4("dalei")%>"><%=rs4("dalei")%></OPTION>
          <%
           rs4.movenext
           next
		   rs4.close
		   set rs4=nothing
          %>
		  </select>
	&nbsp;&nbsp;
	所属小类：<select name="xl">
		  <OPTION selected value="">==请选类型==</OPTION>
		  </select>
    <input type="submit" name="submit" value="添加">
    <br>&nbsp;&nbsp;&nbsp;&nbsp;
    <font color="#CC0000">* 默认密码8888&nbsp;请立即登陆个人中心修改</font></td>
	</form>
  </tr>
  <tr align="center" bgcolor="#ff6666">
    <td width="118" height="40"><b style="color:#0033CC">用户名称</b></td>
    <td width="101"><b style="color:#0033CC">所属大类</b></td>
    <td width="81"><b style="color:#0033CC">所属小类</b></td>
    <td width="130"><b style="color:#0033CC">注册时间</b></td>
    <td width="242"><b style="color:#0033CC">操 作</b></td>
  </tr>
          <%
    if rs.bof and rs.eof then
	   response.Write("<tr><td>没有该用户</td></tr>")
	else
		  dim page
		  rs.pagesize=12
          page=clng(Request.QueryString("page"))
          if page<1 then page=1
          if page>rs.pagecount then page=rs.pagecount
          rs.absolutepage=page
          for i=1 to rs.pagesize
		       if rs.eof then
		       exit for
		       end if
		  %>
  <tr bgcolor="#ff6666">
  <form action="zhuan.asp?id=<%=rs("id")%>&action=xg" method="post">
    <td height="30">&nbsp;&nbsp;&nbsp;<img src="../images/zhuan.gif" width="14" height="14">&nbsp;<b><%=rs("username")%></b></td>
    <td align="center"><input name="zhuan_dl" type="text" id="zhuan_dl" value="<%=rs("zhuan_dl")%>" size="10" align="absmiddle"></td>
    <td align="center"><font color="#FF6600">
      <input name="zhuan_xl" type="text" id="zhuan_xl" value="<%=rs("zhuan_xl")%>" size="10" align="absmiddle">
    </font></td>
    <td>&nbsp;&nbsp;&nbsp;<%=rs("regtime")%></td>
    <td align="center"><input name="提交" type="submit" value="修 改">&nbsp;&nbsp;
      <a href="zhuan.asp?action=2&id=<%=rs("id")%>" onClick="return confirm('您确定？')">取消专家</a>&nbsp;&nbsp;<a href="kw_user.asp?action=sc&id=<%=rs("id")%>" onClick="return confirm('您确定进行删除操作吗？')">删除 ？</a>&nbsp;&nbsp;<img src="images/email.gif" width="15" height="16" alt="发送邮件" onClick="window.open('mail2.asp?usermail=<%=rs("usermail")%>','popdown','width=680,height=450,top=100,left=100')"></td>
  </form>
  </tr>
  <%
       rs.movenext
       next
  end if
  if username="" then
  %>
  <tr align="center" bgcolor="#ff6666">
    <td colspan="5">
	<a href="zhuan.asp?page=1">首页</a>&nbsp;&nbsp;&nbsp;&nbsp;
	<a href="zhuan.asp?page=<%=page-1%>">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;
	<a href="zhuan.asp?page=<%=page+1%>">下一页</a>&nbsp;&nbsp;&nbsp;&nbsp;
	<a href="zhuan.asp?page=<%=rs.pagecount%>">尾页</a></td>
  </tr>
</table>
<%
  end if
  rs.close
  set rs=nothing
  closedb
%>
</body>
</html>
