<!--#include file="../conn.asp"-->
<!--#include file="admin_check.asp"-->
<!--#include file="../inc/class_upload.asp"-->
<!--#include file="../inc/function.asp"-->
<!--#include file="../inc/editor/class_fckeditor.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>管理页面</title>
<link id="maincss" rel="stylesheet" href="images/css/admin_style_<%= AdminSkin %>.css" type="text/css" media="all" />
<script language="JavaScript" src="../js/class.js"></script>
<script language="javascript" src="../js/askA.js"></script>
<script language="javascript">
function CheckAll()
{
var length = document.formed.checkbox.length;
var tocheck = document.formed.SelectAll.checked;

  if (length>=2)
  {
    for (var i=0; i<length; i++){document.formed.checkbox[i].checked = tocheck;}
   }
  else
  {
    document.formed.checkbox.checked = tocheck;    
  }
   
}

function Cdiv()
{
	if (classDiv.style.display=="none")
	{
	classDiv.style.display="block";
	Ctext.innerHTML="放弃";
	}
	else
	{
	document.frm.select1.value="0";
	document.frm.select2.value="0";
	document.frm.select3.value="0";
	document.frm.select4.value="0";
	classDiv.style.display="none";
	Ctext.innerHTML="更换";
	
	}  
}

function checkNum()
{
var length = document.addtp.selectTP.length;
var tocheck=false;
var n=0;

  if (length>=2)
  {
  
    for (var i=0; i<length; i++)
	 {
		if (document.addtp.selectTP[i].checked ==true)
		{
		tocheck=true;
		n=n+1;
		}
	 }
	 if (n>5)
	 {
	     alert("投票选择不能超过5个回答！");
		 tocheck=false;
	 }
	 
   }
  else
  {
		if (document.addtp.selectTP.checked ==true){tocheck=true;}
  }
  
  if (tocheck==true)
  {
    document.addtp.bs1.disabled = false; 
   }
  else
  {
    document.addtp.bs1.disabled = true; 
  }
  
}

function showsc()
{
if (sc.style.display=="none")
{
sc.style.display="block";
}
else
{
sc.style.display="none";
}
}
</script>
<script language="JavaScript" src="../js/class.js"></script>
<script language="javascript" src="../js/askA.js"></script>
<script language="javascript" src="../inc/AjaxAans.js"></script>
<style type="text/css">
<!--
#ask {
	background-image: url(Images/icons.gif);
	background-position: 0px 48px;
	height: 16px;
	width: 16px;
	margin-right: 6px;
	margin-left: 6px;
}
#ans {
	background-image: url(Images/icons.gif);
	background-position: 0px 144px;
	height: 16px;
	width: 16px;
	margin-right: 6px;
	margin-left: 6px;
}
#sta {
	background-image: url(Images/icons.gif);
	background-position: 0px 16px;
	height: 16px;
	width: 16px;
	margin-right: 6px;
	margin-left: 6px;
}
#tp {
	background-image: url(Images/icons.gif);
	background-position: 0px 64px;
	height: 16px;
	width: 16px;
	margin-right: 6px;
	margin-left: 6px;
}
#pl {
	background-image: url(Images/icons.gif);
	background-position: 0px 112px;
	height: 16px;
	width: 16px;
	margin-right: 6px;
	margin-left: 6px;
}
#stated {
	height: 15px;
	width: 41px;
}
ul {
	margin: 0px;
	padding: 0px;
}
li {
	margin: 0px;
	padding: 0px;
}
-->
</style>
</head>
<body leftmargin="0" bottommargin="0" rightmargin="0" topmargin="5" marginheight="0" marginwidth="0" bgcolor="#DDEEFF">
<%
Call chkFlag(1)

Dim act,popans
act=Trim(Request.QueryString("act"))
Dim AskD
Set AskD = Server.CreateObject("KwAsk.FunAsk")
	opendb
	set AskD.myConn =conn
	AskD.myPredb =predb
	AskD.Getsetting()
	siteinfo=AskD.siteinfo
	setting=AskD.setting
	regForm=AskD.regForm
	
Select Case Act
  Case "show"
    Call show()
  Case "modiaskupfileF"
    Call modiask()
  Case "modiansupfileF"
    Call modians()
  Case "delpl"
    Call delpl()
  Case "pass"
    Call pass()
  Case "cn"
    Call cn()
  Case "tp"
    Call tp()
  Case "modicomm"
    Call modicomm()
  Case "savepl"
    Call savepl()
  Case "delans"
    Call delans()
  Case "delask"
    Call delask()
  Case "strong"
    Call strong()
  Case "savestrong"
	Call savestrong()
  Case "shutstrong"
    Call shutstrong()
  Case "delfile"
    Call delfile()
  Case "move"
    Call moves()
  Case "moved"
    Call moved()
  Case else
    Call Main()
End Select
set AskD.myConn =Nothing
Closedb
Set AskD = Nothing

Sub delfile()
Dim types,id,filepath,askid
types=Trim(Request.QueryString("type"))
id=Trim(Request.QueryString("id"))
filepath=Trim(Request.QueryString("filepath"))
askid=Trim(Request.QueryString("askid"))
IF types=1 Then
    Conn.execute("update "&predb&"ask set upfile='' where askid="&id)
Else
    Conn.execute("update "&predb&"ans set upfile='' where ansid="&id)
End IF
	Dim Fso
	Set FSO = server.CreateObject("Scripting.FileSystemObject")
	IF FSO.FileExists(Server.mappath(filepath)) Then
	   FSO.DeleteFile server.MapPath(filepath),True
	End IF
	Set FSO = Nothing
   
   Call SendMsg("文件删除成功")
   Response.Write("<script>setTimeout(""location.href='?act=show&id="&askid&"'"",2000)</script>")
End Sub

sub moved()
   Dim id,classid
   id=Trim(Request.Form(("id")))
   if id="" then id=0
   
  IF Request.Form("select4")<1 Then
       IF Request.Form("select3")<1 Then
             IF Request.Form("select2")<1 Then
				IF Request.Form("select1")<1 Then
					''
				Else
					Classid=Request.Form("select1")
				End If 
             Else
                Classid=Request.Form("select2")
             End If
       Else
             Classid=Request.Form("select3")
       End If
  Else
      Classid=Request.Form("select4")
  End If
  
  conn.execute("update "&predb&"ask set sclass="&classid&" where askid in("&id&")")
   
   Call SendMsg("转移问题成功")
   Response.Write("<script>setTimeout(""location.href='?'"",2000)</script>")
end sub

Sub shutstrong()
   Dim id
   id=Trim(Request.QueryString("id"))
   conn.execute("update "&predb&"ask set isstrong=0 where askid="&id)
   
   Call SendMsg("取消推荐成功")
   Response.Write("<script>setTimeout(""location.href='?'"",2000)</script>")
end sub

Sub Pass()
   dim askid,rs,sql,s
   askid=Trim(Request.QueryString("askid"))
   s=Trim(Request.QueryString("s"))
   set rs= Server.CreateObject("adodb.recordset")
   sql="select ispass from "&predb&"ask where askid="&askid
   rs.open sql,conn,1,3
   if rs("ispass")=0 then
      rs("ispass")=1
   else
      rs("ispass")=0
   end if
   rs.update
   rs.close
   set rs=nothing
   
   Call SendMsg("修改审核成功")
   IF s="1" Then
   Response.Write("<script>setTimeout(""location.href='?act=show&id="&askid&"'"",2000)</script>")
   ELse
   Response.Write("<script>setTimeout(""location.href='?'"",2000)</script>")
   End IF
End Sub

sub delask()
  dim askid,rs,sql,upfile,askuser,checkbox,rs1
  askid=Trim(Request.QueryString("askid"))
  checkbox=Trim(Request.Form("checkbox"))
  IF askid="" then askid=checkbox
  IF askid<>"" Then
	  set rs= Server.CreateObject("adodb.recordset")
	  sql="select * from "&predb&"ask where askid in("&askid&")"
	  rs.open sql,conn,1,1
	  do while not rs.eof
	  
		  upfile=rs("upfile")
		  askuser=rs("askuser")

			  Dim Fso
			  Set FSO = server.CreateObject("Scripting.FileSystemObject")
				IF FSO.FileExists(Server.mappath("../UploadFile/"&upfile)) Then
				   FSO.DeleteFile server.MapPath("../UploadFile/"&upfile),True
				End IF
			  Set FSO = Nothing
		  conn.execute("delete from "&predb&"Comments where ToID="&rs("askid")&" and type=1")
		
		  conn.execute("update "&predb&"user set asknum=asknum-1 where id="&askuser)
		  
		  set rs1=conn.execute("select ansid from "&predb&"ans where askid="&rs("askid"))
		  do while not rs1.eof
			 popans=rs1("ansid")
			 Call delans()
		  rs1.movenext
		  loop
		  set rs1=nothing
		  
		  conn.execute("delete from "&predb&"ask where askid="&rs("askid"))
      rs.movenext
	  loop
	  rs.close
	  set rs=nothing
	  
      Call AskD.Score(askuser,-clng(setting(19)),"提问被删除")
      Call SendMsg("删除提问成功")
      Response.Write("<script>setTimeout(""location.href='?'"",2000)</script>")
  Else
      Response.Write("<script>history.go(-1)</script>")
  End IF
end sub

sub delans()
  dim ansid,rs,sql,askid,ansuser,San,upfile,iscn,bcn
  ansid=Trim(Request.QueryString("ansid"))
  if ansid="" then ansid=popans
  set rs= Server.CreateObject("adodb.recordset")
  sql="select * from "&predb&"ans where ansid="&ansid
  rs.open sql,conn,1,1
  askid=rs("askid")
  ansuser=rs("ansuser")
  upfile=rs("upfile")
  iscn=rs("iscn")
  rs.close
  set rs=nothing
  
      Dim Fso
      Set FSO = server.CreateObject("Scripting.FileSystemObject")
	    IF FSO.FileExists(Server.mappath("../UploadFile/"&upfile)) Then
           FSO.DeleteFile server.MapPath("../UploadFile/"&upfile),True
	    End IF
      Set FSO = Nothing
	  
  set rs= Server.CreateObject("adodb.recordset")
  sql="select * from "&predb&"ask where askid="&askid
  rs.open sql,conn,1,3
  rs("ansnum")=rs("ansnum")-1
  san=replace(rs("ansuser")&",",","&ansuser&",",",")
  san=left(san,len(san)-1)
  rs("ansuser")=san
  if iscn=1 then
     rs("state")=0
  end if
  rs.update
  rs.close
  set rs=nothing
  
  if iscn=1 then
     bcn=",bcn=bcn-1"
  end if
  
  conn.execute("update "&predb&"user set ansnum=ansnum-1"&bcn&" where id="&ansuser)
  conn.execute("delete from "&predb&"ans where ansid="&ansid)
  conn.execute("delete from "&predb&"Comments where ToID="&ansid&" and type=2")
  IF popans="" Then Call AskD.Score(ansuser,-clng(setting(20)),"回答被删除")
  
  Call SendMsg("删除回答成功")
  Response.Write("<script>setTimeout(""location.href='?'"",2000)</script>")
end sub

sub delpl()
    dim id,rs,sql,toid,types,commuser
	id=Trim(Request.Form("id"))
    set rs= Server.CreateObject("adodb.recordset")
    sql="select * from "&predb&"Comments where id="&id
    rs.open sql,conn,1,1
    toid=rs("toid")
    types=rs("type")
	commuser=rs("commuser")
	rs.close
	set rs=nothing
	
	if types=1 then
	   conn.execute("update "&predb&"ask set comNum=comNum-1 where askid="&toid)
	else
	   conn.execute("update "&predb&"ans set comNum=comNum-1 where ansid="&toid)
	end if
	
	conn.execute("delete from "&predb&"comments where id="&id)
	Call AskD.Score(commuser,-clng(setting(21)),"评论被删除")
	
    Call SendMsg("评论删除成功")
    Response.Write("<script>setTimeout(""location.href='?toid="&toid&"&type="&types&"&act=modicomm'"",2000)</script>")
end sub

sub tp()
  dim askid,tpmax,selectTP,rs,sql
  askid=Trim(Request.Form("askid"))
  tpmax=Trim(Request.Form("tpmax"))
  selectTP=Trim(Request.Form("selectTP"))
  conn.execute("update "&predb&"ans set istp=0,TpNum=0,zcTP=0,fdTP=0 where askid="&askid)
  
  set rs= Server.CreateObject("adodb.recordset")
  sql="select * from "&predb&"ask where askid="&askid
  rs.open sql,conn,1,3
  if rs("bcnans")>0 then
     conn.execute("update "&predb&"ans set iscn=0 where ansid="&rs("bcnans"))
	 conn.execute("update "&predb&"user set bcn=bcn-1 where id="&rs("bcnuser"))
	 rs("bcnans")=0
	 rs("bcnuser")=0
  end if  
  rs("tpmax")=tpmax
  rs("state")=4 
  rs.update
  rs.close
  set rs=nothing
  conn.execute("update "&predb&"ans set istp=1 where ansid in("&selectTP&")")
  
  Call SendMsg("投票设置成功")
  Response.Write("<script>setTimeout(""location.href='?act=show&id="&askid&"'"",2000)</script>")
end sub

sub savepl()
  dim id,Comments,rs,sql,toid,types
  id=Trim(Request.Form("id"))
  Comments=Trim(Request.Form("Comments"))
  set rs= Server.CreateObject("adodb.recordset")
  sql="select * from "&predb&"Comments where id="&id
  rs.open sql,conn,1,3
  toid=rs("toid")
  types=rs("type")
  rs("Comments")=Comments
  rs.update
  rs.close
  set rs=nothing
  
  Call SendMsg("评论修改成功")
  Response.Write("<script>setTimeout(""location.href='?toid="&toid&"&type="&types&"&act=modicomm'"",2000)</script>")
end sub

Sub cn()
dim askid,ansid,uid,rs,sql
askid=clng(Request.QueryString("askid"))
ansid=clng(Request.QueryString("ansid"))
uid=clng(Request.QueryString("uid"))
set rs= Server.CreateObject("adodb.recordset")
sql="select * from "&predb&"ask where askid="&askid
rs.open sql,conn,1,3

if rs("bcnans")>0 then
   conn.execute("update "&predb&"ans set iscn=0 where ansid="&rs("bcnans"))
   conn.execute("update "&predb&"user set bcn=bcn-1 where id="&rs("bcnuser"))
end if

rs("State")=6
rs("bcnuser")=uid
rs("bcnans")=ansid
rs.update
rs.close
set rs=nothing

conn.execute("update "&predb&"ans set iscn=1 where ansid="&ansid)
conn.execute("update "&predb&"user set bcn=bcn+1 where id="&uid)

Call SendMsg("管理采纳成功")
Response.Write("<script>setTimeout(""location.href='?act=show&id="&askid&"'"",2000)</script>")
End Sub

Sub ModiAsk()
  Dim UpFile,sSavePath,UstrFtyp,ufl,pSavePath
	sSavePath ="../UploadFile/"&Year(date())&Right("0"&Month(date()),2)&"/"
    pSavePath=replace(sSavePath,"../UploadFile/","")
	Dim oFSO,oFile
	oFile=server.MapPath(sSavePath)
	Set oFSO = server.CreateObject("Scripting.FileSystemObject")
	if oFSO.FolderExists(oFile)=false then
	   oFSO.CreateFolder(oFile)
	end if
	Set oFSO = Nothing
	
	set UpFile = New UpLoadClass
	UpFile.AutoSave = 2
	UpFile.MaxSize =  Int(setting(28) * 1024) '# (1024*1024=1M) SESSION里的单位为KB
	UpFile.FileType = setting(29)
	UpFile.SavePath = sSavePath
	UpFile.Open()
	If UpFile.Save("upfile",0) Then
	    UstrFtyp=Ucase(UpFile.strFtyp)
		IF UstrFtyp="TEXT/PLAIN" Then
		Response.Write "<div style=""padding:6px"">注意：请上传正确文件！</div>"
		Response.End()
		End IF
	Else
		Select Case UpFile.Form("upfile_Err")
		Case -1 : Response.Write ""  '允许不上传文件
		Case 1 : Response.Write "文件大小超出限制，请返回重新上传":Response.End()
		Case 2 : Response.Write "不允许上传的文件类型，请返回重新上传":Response.End()
		Case 3 : Response.Write "文件大小超出限制并且是不允许上传的文件类型，请返回重新上传":Response.End()
		Case Else : Response.Write "未知错误，请返回重新上传":Response.End()
		End Select
	End If
	
Dim sClass,title,content,addedcont,upfiles,addurl,states,checkbox,id,rs,sql
  IF UpFile.Form("select4")<1 Then
       IF UpFile.Form("select3")<1 Then
             IF UpFile.Form("select2")<1 Then
				IF UpFile.Form("select1")<1 Then
					''
				Else
					sClass=UpFile.Form("select1")
				End If 
             Else
                sClass=UpFile.Form("select2")
             End If
       Else
             sClass=UpFile.Form("select3")
       End If
  Else
      sClass=UpFile.Form("select4")
  End If
  id=UpFile.Form("id")
  title=UpFile.Form("title")
  content=UpFile.Form("content")
  addedcont=UpFile.Form("addedcont")
  upfiles=UpFile.Form("upfile")
  addurl=UpFile.Form("addurl")
  states=UpFile.Form("state")
  checkbox=UpFile.Form("checkbox")
  Set UpFile = Nothing

  set rs= Server.CreateObject("adodb.recordset")
  sql="select * from "&predb&"ask where askid="&id
  rs.open sql,conn,1,3
      rs("title")=title
  IF sClass>0 Then
      rs("sclass")=sclass
  End IF
      rs("content")=content
      rs("addedcont")=addedcont
  if upfiles<>"" then
      Dim Fso
      Set FSO = server.CreateObject("Scripting.FileSystemObject")
	    IF FSO.FileExists(Server.mappath("../UploadFile/"&rs("upfile"))) Then
           FSO.DeleteFile server.MapPath("../UploadFile/"&rs("upfile")),True
	    End IF
      Set FSO = Nothing
      rs("upfile")=pSavePath&upfiles	  
  end if

      rs("addurl")=addurl
  IF checkbox="1" Then
      rs("state")=states
  End IF
  
  if (states=0 or states=2 or states=3) and rs("bcnans")>0 then
     conn.execute("update "&predb&"ans set iscn=0 where ansid="&rs("bcnans"))
	 conn.execute("update "&predb&"user set bcn=bcn-1 where id="&rs("bcnuser"))
	 rs("bcnans")=0
	 rs("bcnuser")=0
  end if
  rs.update
  rs.close
  set rs=nothing
  
  Call SendMsg("修改提问成功")
  Response.Write("<script>setTimeout(""location.href='?act=show&id="&id&"'"",2000)</script>")
End Sub

Sub ModiAns()
  Dim UpFile,sSavePath,UstrFtyp,ufl,pSavePath
	sSavePath ="../UploadFile/"&Year(date())&Right("0"&Month(date()),2)&"/"
    pSavePath=replace(sSavePath,"../UploadFile/","")
	Dim oFSO,oFile
	oFile=server.MapPath(sSavePath)
	Set oFSO = server.CreateObject("Scripting.FileSystemObject")
	if oFSO.FolderExists(oFile)=false then
	   oFSO.CreateFolder(oFile)
	end if
	Set oFSO = Nothing
	
	set UpFile = New UpLoadClass
	UpFile.AutoSave = 2
	UpFile.MaxSize =  Int(setting(32) * 1024) '# (1024*1024=1M) SESSION里的单位为KB
	UpFile.FileType = setting(33)
	UpFile.SavePath = sSavePath
	UpFile.Open()
	If UpFile.Save("upfile",0) Then
	    UstrFtyp=Ucase(UpFile.strFtyp)
		IF UstrFtyp="TEXT/PLAIN" Then
		Response.Write "<div style=""padding:6px"">注意：请上传正确文件！</div>"
		Response.End()
		End IF
	Else
		Select Case UpFile.Form("upfile_Err")
		Case -1 : Response.Write ""  '允许不上传文件
		Case 1 : Response.Write "文件大小超出限制，请返回重新上传":Response.End()
		Case 2 : Response.Write "不允许上传的文件类型，请返回重新上传":Response.End()
		Case 3 : Response.Write "文件大小超出限制并且是不允许上传的文件类型，请返回重新上传":Response.End()
		Case Else : Response.Write "未知错误，请返回重新上传":Response.End()
		End Select
	End If

Dim id,anscontent,upfiles,addurl,askid,rs,sql
  id=UpFile.Form("id")
  askid=UpFile.Form("askid")
  anscontent=UpFile.Form("anscontent"&id)
  upfiles=UpFile.Form("upfile")
  addurl=UpFile.Form("addurl")
  Set UpFile = Nothing
  
  set rs= Server.CreateObject("adodb.recordset")
  sql="select * from "&predb&"ans where ansid="&id
  rs.open sql,conn,1,3
  rs("anscontent")=anscontent
  rs("addurl")=addurl
  
  if upfiles<>"" then
      Dim Fso
      Set FSO = server.CreateObject("Scripting.FileSystemObject")
	    IF FSO.FileExists(Server.mappath("../UploadFile/"&rs("upfile"))) Then
           FSO.DeleteFile server.MapPath("../UploadFile/"&rs("upfile")),True
	    End IF
      Set FSO = Nothing
      rs("upfile")=pSavePath&upfiles 
  end if
  rs.update
  rs.close
  set rs=nothing
  
  Call SendMsg("修改回答成功")
  Response.Write("<script>setTimeout(""location.href='?act=show&id="&askid&"'"",2000)</script>")
End Sub

Sub savestrong()
   Dim askid,check,askuser,rs,sql
   askid=Trim(Request.QueryString("askid"))
   check=Trim(Request.Form("check"))
   set rs= Server.CreateObject("adodb.recordset")
   sql="select askuser,isstrong,strongtime,xgstrong from "&predb&"ask where askid="&askid
   rs.open sql,conn,1,3
	   askuser=rs("askuser")
	   rs("isstrong")=1
	   rs("strongtime")=now()
	   rs("xgStrong")=check
	   rs.update
   rs.close
   set rs=nothing
   
   Call AskD.Score(askuser,setting(18),"提问被推荐")
   Call SendMsg("推荐问题成功")
   Response.Write("<script>setTimeout(""location.href='?'"",2000)</script>")
End Sub

Sub Strong()
dim askid,rs,title,upfile,xgStrong,sql,key,rs1,i,strsql,Checked
askid=Trim(Request.QueryString("askid"))
set rs=conn.execute("select title,upfile,xgStrong from "&predb&"ask where askid="&askid)
    title=rs("title")
	upfile=rs("upfile")
	xgStrong=" "&rs("xgStrong")&","
set rs=nothing
%>
<table class="tableBorder" cellspacing="1" cellpadding="2" width="96%" align="center" border="0">
  <tr>
	<th height="25" colspan="2" align="left"><span id="ask"></span><%= title %> &nbsp; <% If upfile="" or isnull(upfile) Then %><font color="#FF0000">无图</font>(请上传图片 212*72)<% End If %></th>
  </tr>
  <form method="post" action="?act=savestrong&askid=<%= askid %>">
  <tr>
    <td width="19%" align="right" class="TableRow1"><strong>选择相关问题：</strong><br><font color="#999999">(建议选择并只选 3 条)</font></td>
    <td width="81%" class="TableRow1">
    <ul>
<%
	Const pk=3 '截取字符数
	sql="select top 30 askid,title from "&predb&"ask where ispass=1 and ("
		strsql="title like '%"&left(title,pk)&"%'"
	For i=pk+1 To len(title)
		key=mid(title,i,pk)
		IF len(key)<pk Then Exit For
		strsql=strsql&" or title like '%"&key&"%'"
	Next
	sql=sql&strsql
	sql=sql&") and askid<>"&askid&" order by askid desc"

    Set rs= Server.CreateObject("adodb.recordset")
	rs.open sql,conn,1,1
	IF not(rs.bof And rs.eof) Then
		do while not rs.eof
		IF instr(xgStrong," "&rs("askid")&",")>0 Then Checked="checked" Else Checked=""
		   Response.Write("<li><input name=""check"" type=""checkbox"" "&Checked&" value="""&rs("askid")&"""> <a target=""_blank"" href=""../ask.asp?id="&rs("askid")&""">"&rs("title")&"</a></li>")
		rs.movenext
		loop
	Else
	    Response.Write("<li>暂无相关…</li>")
	End IF
	rs.close
	set rs=nothing
%>
</ul>
    </td>
  </tr>
  <tr>
    <td align="right" class="TableRow1">&nbsp;</td>
    <td class="TableRow1"><input type="submit" name="button9" id="button9" value="确认推荐">
      &nbsp; <input type="button" name="button10" id="button10" value="管理提问" onClick="location.href='?act=show&id=<%= askid %>'">
      &nbsp; <input type="button" name="button10" id="button10" value="返回管理" onClick="location.href='?'">
      &nbsp; <input type="button" name="button10" id="button10" value="取消推荐" onClick="location.href='?act=shutstrong&id=<%= askid %>'">
      </td>
  </tr>
  </form>
</table>
<%
End Sub

Sub modicomm()
dim toid,types,rs,i
toid=Trim(Request.QueryString("toid"))
types=Trim(Request.QueryString("type"))

set rs=conn.execute("select * from "&predb&"comments where toid="&toid&" and type="&types)
%>
<table class="tableBorder" cellspacing="1" cellpadding="2" width="96%" align="center" border="0">
  <tr>
	<th height="25" colspan="2" align="left"><span id="pl"></span>评论管理</th>
  </tr>
<%
do while not rs.eof
i=i+1
%>
  <form action="?act=delpl" method="post"><input name="id" type="hidden" value="<%= rs("id") %>">
  <tr>
    <td width="14%" align="right" class="TableRow1"><strong>评论信息：      </strong></td>
    <td width="86%" class="TableRow1"><font color="#008800">评论<b><%= i %></b> &nbsp; <%= ShowUser2(rs("CommUser")) %> &nbsp; <%= rs("Commtime") %></font></td>
  </tr>
  <tr>
    <td align="right" class="TableRow2"><strong>评论内容：</strong></td>
    <td class="TableRow2"><textarea name="Comments" cols="88" rows="6"><%= rs("Comments") %></textarea></td>
  </tr>
  <tr>
    <td align="right" class="TableRow1">&nbsp;</td>
    <td class="TableRow1"><input type="submit" name="bs1" value="修改评论" onClick="this.form.action='?act=savepl';"> &nbsp; <input type="submit" onClick="return confirm('请确认您的操作？');" name="bs1" value="删除评论"></td>
  </tr>
  <tr>
    <td align="right" class="TableRow2">&nbsp;</td>
    <td class="TableRow2">&nbsp;</td>
  </tr>
  </form>
<%
rs.movenext
loop
set rs=nothing
%>
</table>
<%
End Sub

Sub Show()
Dim rs,id,states,memo
id=Trim(Request.QueryString("id"))
set rs=conn.execute("select * from "&predb&"ask where askid="&id)
states=rs("state")
%>
<table class="tableBorder" cellspacing="1" cellpadding="2" width="96%" align="center" border="0">
  <form action="?act=modiaskupfileF" enctype="multipart/form-data" method="post" name="frm"><input name="id" type="hidden" value="<%= id %>">
  <tr>
	<th height="25" colspan="2" align="left"><span id="ask"></span><%= rs("title") %>
     &nbsp;<span id="sta"></span><%
	IF rs("isPass")=0 then
	Response.Write("待审核")
	Else
	select case states
	case 0
	Response.Write("解决中")
	case 1
	Response.Write("已采纳")
	memo="问者采纳"
	case 2
	Response.Write("已过期")
	case 3
	Response.Write("已撤销")
	case 4
	Response.Write("投票中")
	case 5
	Response.Write("已投票")
	memo="投票采纳"
	case 6
	Response.Write("管理采")
	memo="管理采纳"
	case 7
	Response.Write("专家采")
	memo="专家采纳"
	case 8
	Response.Write("无满意")
	end select
	End IF
	%>    </th>
  </tr>
  <tr>
    <td width="14%" align="right" class="TableRow1"><strong>问题信息：</strong></td>
    <td width="86%" class="TableRow1">
    <font color="#008800">提问者：<%= showUser2(rs("askuser")) %> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 提问时间：<%= rs("asktime") %></font></td>
  </tr>
  <tr>
    <td align="right" class="TableRow2"><strong>所属栏目：</strong></td>
    <td class="TableRow2">
	<%= Askclass(rs("sClass")) %> [<font color="#FF0000" onclick="Cdiv()" id="Ctext" style="cursor:pointer">更换</font>]
    <div id="classDiv" style="display:none">
    <select name="select1" size="12" id="select1" style="width:88px" onChange="searchlist2(this.form);">
    </select>  
		<script language="JavaScript">
			searchinit1("", 0);
		</script>
      <select name="select2" size="12" id="select2" style="width:88px" onChange="searchlist3(this.form);">
      </select>
	    <script language="JavaScript">
			searchinit2("", 0);
		</script>
      <select name="select3" size="12" id="select3" style="width:88px" onChange="searchlist4(this.form);">
      </select>
	    <script language="JavaScript">
			searchinit3("", 0);
		</script>
      <select name="select4" size="12" id="select4" style="width:88px">
      </select>
		<script language="JavaScript">
			searchinit4("", 0);
		</script>  
    </div>    </td>
  </tr>
  <tr>
    <td align="right" class="TableRow1"><strong>问题标题：</strong></td>
    <td class="TableRow1"><input name="title" type="text" id="title" size="68" value="<%=rs("title")%>"></td>
  </tr>
  <tr>
    <td align="right" class="TableRow2"><strong>问题内容：</strong></td>
    <td class="TableRow2" id="input0"><textarea name="content" cols="88" rows="6" onFocus="getAjax(0,this.value)"><%= server.HTMLEncode(rs("content")) %></textarea></td>
  </tr>
  <tr>
    <td align="right" class="TableRow1"><strong>补充内容：</strong></td>
    <td class="TableRow1"><textarea name="addedcont" cols="68" rows="3"><%= rs("AddedCont") %></textarea> <font color="#999999"><%= rs("Addedtime") %></font></td>
  </tr>
  <tr>
    <td align="right" class="TableRow2"><strong>上传文件：</strong></td>
    <td class="TableRow2">
    <input type="file" name="upfile"><% If rs("upfile")&""<>"" Then %> <a href="../UploadFile/<%= rs("upfile") %>" target="_blank">查看已上传文件</a> &nbsp;[<a href="?act=delfile&id=<%=rs("askid")%>&type=1&askid=<%= id %>&filepath=../UploadFile/<%= rs("upfile") %>" onClick="return confirm('确认删除么?')"><font color="#FF0000">删除文件</font></a>]<% End If %></td>
  </tr>
  <tr>
    <td align="right" class="TableRow1"><strong>参考地址：</strong></td>
    <td class="TableRow1">
    <input name="addurl" type="text" size="38" value="<%= rs("addurl") %>"></td>
  </tr>
  <tr>
    <td align="right" class="TableRow2"><strong>改变状态：</strong></td>
    <td class="TableRow2">
    <select name="state" id="state" onChange="if(this.value!=-1){checkbox.disabled=false;}else{checkbox.disabled=true;}">
      <option value="-1">修改状态</option>
      <option value="0">解决中</option>
      <% If states=5 or states=6 or states=7 Then %>
      <option value="1">已采纳</option>
      <% End If %>
      <option value="2">已过期</option>
      <option value="3">已撤销</option>
      <% If states=1 or states=6 or states=7 Then %>
      <option value="5">已投票</option>
      <% End If %>
      <% If states=1 or states=5 or states=7 Then %>
      <option value="6">管理采</option>
      <% End If %>
      <% If states=1 or states=5 or states=6 Then %>
      <option value="7">专家采</option>
      <% End If %>
    </select>
    <input name="checkbox" type="checkbox" value="1" disabled>
    确定改变
     &nbsp; <font color="#0000FF">仅用于采纳方式和过期状态的变更，举行投票或管理采纳请直接操作！</font></td>
  </tr>
  <tr>
    <td align="right" class="TableRow1">&nbsp;</td>
    <td class="TableRow1"><input type="submit" name="button2" id="button2" value="修改问题">
      &nbsp; <input type="button" name="button3" onClick="if(confirm('确认删除么？')){location.href='?act=delask&askid=<%= id %>';}return false;" id="button3" value="删除问题">
&nbsp;
<input type="button" name="button4" id="button4" onClick="if(tpDiv.style.display=='none'){tpDiv.style.display='block'}else{tpDiv.style.display='none'}" value="举行投票">
&nbsp;
<input type="button" name="button4" id="button4" onClick="location.href='?act=pass&s=1&askid=<%= id %>'" value="审核提问">
&nbsp;
<input type="button" name="button4" id="button4" onClick="location.href='?act=strong&s=1&askid=<%= id %>'" value=" 推 荐 ">
<% If rs("comNum")>0 Then %>&nbsp;
<input type="button" name="button6" id="button6" onClick="location.href='?toid=<%= id %>&type=1&act=modicomm'" value="评论管理 <%= rs("comNum") %>">
<% End If %></td>
  </tr>
  </form>
</table>
<br>
<%
set rs=nothing
dim i
set rs=conn.execute("select * from "&predb&"ans where askid="&id)
%>
<div id="tpDiv" style="display:none">
<table class="tableBorder" cellspacing="1" cellpadding="2" width="96%" align="center" border="0">
  <tr>
	<th height="25" colspan="2" align="left"><span id="tp"></span>投票管理</th>
  </tr>
  <form action="?act=tp" method="post" name="addtp"><input name="askid" type="hidden" value="<%= id %>">
  <tr>
    <td width="18%" align="right" class="TableRow1"><strong>设定投票数上限：</strong></td>
    <td width="82%" class="TableRow1">
   <select name="tpmax">
      <option selected>10</option>
      <option>20</option>
      <option>30</option>
      <option>50</option>
    </select></td>
  </tr>
  <tr>
    <td align="right" class="TableRow2"><strong>选择待投票回答：</strong></td>
    <td class="TableRow2">
    <%
	do while not rs.eof
	i=i+1
	%>
    <input type="checkbox" onClick="checkNum()" name="selectTP" value="<%= rs("ansid") %>">回答<%= i %>&nbsp;&nbsp; 
    <%
	rs.movenext
	loop
	%>
   </td>
  </tr>
  <tr>
    <td align="right" class="TableRow1">&nbsp;</td>
    <td class="TableRow1"><input type="submit" name="bs1" value="确认举行投票" disabled></td>
  </tr>
  </form>
</table>
<br>
</div>
<%
IF not(rs.bof and rs.eof) then 
%>
<table class="tableBorder" cellspacing="1" cellpadding="2" width="96%" align="center" border="0">
  <tr>
	<th height="25" colspan="2" align="left"><span id="ans"></span> 所有回答</th>
  </tr>
<%
i=0
rs.movefirst
do while not rs.eof
i=i+1
%>
<form enctype="multipart/form-data" action="?act=modiansupfileF" method="post" name="forans"><input name="id" type="hidden" value="<%=rs("ansid")%>"><input name="askid" type="hidden" value="<%=rs("askid")%>">
  <tr>
    <td colspan="2" class="TableRow1"><font color="#008800">回答<b><%= i %></b> &nbsp; <%= ShowUser2(rs("ansuser")) %> &nbsp; <%= rs("anstime") %></font><% If rs("isCN")=1 Then %> &nbsp; <font color="#FF0000">被<%= memo %>回答</font><% End If %></td>
  </tr>
  <tr>
    <td width="14%" align="right" class="TableRow2"><strong>回答内容：</strong></td>
    <td width="86%" class="TableRow2" id="input<%=rs("ansid")%>"><textarea name="anscontent<%=rs("ansid")%>" cols="88" onFocus="getAjax(<%=rs("ansid")%>,this.value)" rows="6"><%= server.HTMLEncode(rs("anscontent")) %></textarea></td>
  </tr>
  
  <tr>
    <td align="right" class="TableRow1"><strong>上传文件：</strong></td>
    <td class="TableRow1">
    <input type="file" name="upfile"><% If rs("upfile")<>"" and isnull(rs("upfile"))=false Then %> <a href="../UploadFile/<%= rs("upfile") %>" target="_blank">查看已上传文件</a> &nbsp;[<a href="?act=delfile&id=<%=rs("ansid")%>&type=2&askid=<%= id %>&filepath=../UploadFile/<%= rs("upfile") %>" onClick="return confirm('确认删除么?')"><font color="#FF0000">删除文件</font></a>]<% End If %></td>
  </tr>
  <tr>
    <td align="right" class="TableRow2"><strong>参考地址：</strong></td>
    <td class="TableRow2">
    <input name="addurl" type="text" size="38" value="<%= rs("addurl") %>"></td>
  </tr>
  
  <tr>
    <td align="right" class="TableRow1">&nbsp;</td>
    <td class="TableRow1"><input type="submit" name="button2" id="button2" value="修改回答">
      &nbsp; <input type="button" name="button3" id="button3" onClick="if(confirm('确认删除么？')){location.href='?act=delans&ansid=<%= rs("ansid") %>';}return false;" value="删除回答">
      &nbsp; <input type="button" name="button5" id="button5" onClick="location.href='?act=cn&askid=<%= id %>&ansid=<%= rs("ansid") %>&uid=<%= rs("ansuser") %>'" value="采纳回答">
      <% If rs("comNum")>0 Then %>
      &nbsp;<input type="button" name="button6" id="button6" onClick="location.href='?toid=<%= rs("ansid") %>&type=2&act=modicomm'" value="评论管理 <%= rs("comNum") %>">
      <% End If %>
    </td>
  </tr>
  </form>
  <tr>
    <td colspan="2" align="right" class="TableRow2"><hr color="#FF3366" size="1"></td>
  </tr>
<%
rs.movenext
loop
%>
</table>
<%
end if
set rs=nothing
End Sub

Sub Main()
dim key,sc,sClass,sele
key=Trim(Request.Form("key"))
sc=Trim(Request.Form("sc"))
sele=Trim(Request.Form("sele"))
IF Request.Form("select4")<1 Then
   IF Request.Form("select3")<1 Then
		 IF Request.Form("select2")<1 Then
			IF Request.Form("select1")>0 Then
				sClass=Request.Form("select1")
			End If 
		 Else
			sClass=Request.Form("select2")
		 End If
   Else
		 sClass=Request.Form("select3")
   End If
Else
  sClass=Request.Form("select4")
End If

IF key<>"" Then
  key=" where title like '%"&key&"%'"
Else
  key=" where 1=1"
End IF

IF sc="1" and sClass>0 Then
   key=key&" and sclass="&sclass
End IF

IF sele="9" Then
   key=key&" and isPass=0"
ElseIF sele<>"" Then
   key=key&" and state="&sele
End IF
%>
<table class="tableBorder" cellspacing="1" cellpadding="2" width="96%" align="center" border="0">
  <tr>
		<th height="25" colspan="7" align="left">提问管理</th>
  </tr>
  <form action="?" method="post" name="frm">  
  <tr>
    <td colspan="7" class="TableRow2">搜索问题：
      <input type="text" name="key" id="key">
      <select name="sele" id="sele">
        <option value="">选择问题状态</option>
        <option value="9" <% If sele="9" Then %>selected<% End If %> style="background-color: #0000FF; color:#FFFFFF">待审核</option>
        <option value="0" <% If sele="0" Then %>selected<% End If %> style="background-color: #339A03; color:#FFFFFF">解决中</option>
        <option value="1" <% If sele="1" Then %>selected<% End If %> style="background-color: #F5A52E; color:#FFFFFF">已采纳</option>
        <option value="2" <% If sele="2" Then %>selected<% End If %> style="background-color: #FF0000; color:#FFFFFF">已过期</option>
        <option value="3" <% If sele="3" Then %>selected<% End If %> style="background-color: #A6A6A6; color:#FFFFFF">已撤销</option>
        <option value="4" <% If sele="4" Then %>selected<% End If %> style="background-color: #3FA6D6; color:#FFFFFF">投票中</option>
        <option value="5" <% If sele="5" Then %>selected<% End If %> style="background-color: #CC34FF; color:#FFFFFF">已投票</option>
        <option value="6" <% If sele="6" Then %>selected<% End If %> style="background-color: #CC3401; color:#FFFFFF">管理采</option>
        <option value="7" <% If sele="7" Then %>selected<% End If %> style="background-color: #9999FF; color:#FFFFFF">专家采</option>
      </select>
      &nbsp;
      <label><input name="sc" type="checkbox" id="sc" value="1" onClick="showsc()">按分类搜索</label>
      <input type="submit" name="button7" id="button7" value="开始搜索">
      &nbsp; <input type="button" name="button8" id="button8" onClick="location.href='?'" value="返回首页"></td>
  </tr>
  <tbody id="sc" style="display:none">
  <tr>
    <td colspan="7" class="TableRow2">
    <select name="select1" size="12" id="select1" style="width:88px" onChange="searchlist2(this.form);">
    </select>  
		<script language="JavaScript">
			searchinit1("", 0);
		</script>
      <select name="select2" size="12" id="select2" style="width:88px" onChange="searchlist3(this.form);">
      </select>
	    <script language="JavaScript">
			searchinit2("", 0);
		</script>
      <select name="select3" size="12" id="select3" style="width:88px" onChange="searchlist4(this.form);">
      </select>
	    <script language="JavaScript">
			searchinit3("", 0);
		</script>
      <select name="select4" size="12" id="select4" style="width:88px">
      </select>
		<script language="JavaScript">
			searchinit4("", 0);
		</script> 
    </td>
  </tr>
  </tbody>
  </form>
  <tr>
    <td width="5%" align="center" class="TableRow1"><strong>选中</strong></td>
    <td width="32%" align="center" class="TableRow1"><strong>标题</strong></td>
    <td width="9%" align="center" class="TableRow1"><strong>提问者</strong></td>
    <td width="17%" align="center" class="TableRow1"><strong>提问时间</strong></td>
    <td width="13%" align="center" class="TableRow1"><strong>回答数</strong><strong>\评论数</strong></td>
    <td width="5%" align="center" class="TableRow1"><strong>状态</strong></td>
    <td align="center" class="TableRow1"><strong>操作</strong></td>
  </tr>
  <form method="post" action="?act=delask" name="formed">
<%
dim rs,rs1,i,c,page,maxperpage,minid,n,idcount
maxperpage=25
page=clng(Request.QueryString("page"))
        set rs1=conn.execute("select count(askid) from "&predb&"Ask"&key)
		idcount=rs1(0) 
		set rs1=nothing
		
		If idcount Mod maxperpage = 0 Then
			n = idcount \ maxperpage
		else
			n = idcount \ maxperpage + 1
		end If

IF page>n then page=n		
IF page<1 then page=1

		if page=1 then
            set rs=conn.execute("select top "&maxperpage&" a.*,b.ClassName from "&predb&"ask a inner join "&predb&"class b on a.sclass=b.classid "&key&" order by askid desc")
		else
			set rs1=conn.execute("select min(askid) from (select top "&(page-1)*maxperpage&" askid from "&predb&"ask"&key&" order by askid desc) d")
			    minid=rs1(0)
			set rs1=nothing
			set rs=conn.execute("select top "&maxperpage&" a.*,b.ClassName from "&predb&"ask a inner join "&predb&"class b on a.sclass=b.classid "&key&" and askid<"&minid&" order by askid desc")
		end if
   
do while not rs.eof
i=i+1
if i mod 2=0 then
  c=1
else
  c=2
end if
%>
  <tr>
    <td align="center" class="TableRow<%= c %>"><input name="checkbox" type="checkbox" value="<%= rs("askid") %>"></td>
    <td class="TableRow<%= c %>"><% If rs("niming")=1 Then %><font color="#009900">[匿]</font><% End If %><a href="?act=show&id=<%= rs("askid") %>" title="主题：<%= rs("title") %>&#13;分类：<%= rs("ClassName") %>"><%= askD.Leftstr(rs("title"),40) %></a><% If rs("isStrong")=1 Then %> <font color="#009900">荐！</font><% End If %></td>
    <td class="TableRow<%= c %>"><%= ShowUser(rs("askuser")) %></td>
    <td align="center" class="TableRow<%= c %>"><%= rs("asktime") %></td>
    <td align="center" class="TableRow<%= c %>"><font color="#FF0000"><%= rs("ansNum") %></font>\<font color="#0000FF"><%= rs("comNum") %></font></td>
    <td align="center" class="TableRow<%= c %>">
	<%
	Dim Ynum
	IF rs("isPass")=0 then
	   Ynum=75
	Else
	select case rs("state")
	case 0
	   Ynum=120
	case 1
	   Ynum=45
	case 2
	   Ynum=150
	case 3
	   Ynum=135
	case 4
	   Ynum=90
	case 5
	   Ynum=60
	case 6
	   Ynum=30
	case 7
	   Ynum=15
	case 8
	   Ynum=165
	end select
	End IF
	%>
    <div id="stated" style="background-image: url(Images/state.gif);background-position: 0px <%= Ynum %>px;"></div>    </td>
    <td align="center" class="TableRow<%= c %>"><a href="?act=pass&askid=<%= rs("askid") %>"><% If rs("ispass")=0 Then %><font color="#0000FF">待审</font><% Else %>撤审<% End If %></a> &nbsp;<a href="?act=strong&askid=<%= rs("askid") %>">推荐</a> &nbsp;<a onClick="return confirm('请确认您的操作？');" href="?act=delask&askid=<%= rs("askid") %>">删除</a> &nbsp;<a href="../ask.asp?id=<%= rs("askid") %>" target="_blank">查看</a></td>
  </tr>
<%
rs.movenext
loop
set rs=nothing
%> 
  <tr>
    <td colspan="7" class="TableRow1"><label><input type="checkbox" name="SelectAll" id="SelectAll" onClick="CheckAll()">全选\全不选</label>&nbsp;  
     <input type="submit" name="button" id="button" value="批量转移" onClick="formed.action='?act=move'">
     &nbsp; <input type="submit" name="button" id="button" value="批量删除" onClick="return confirm('请确认您的操作？');">     </td>
  </tr>
 </form>
  <tr>
    <td colspan="7" align="center" class="TableRow2">共<b><%= idcount %></b>则 <font color="#FF0000"><%= page %></font>/<%= n %>页&nbsp;&nbsp; <a href="?page=1">首页</a>&nbsp;&nbsp; <a href="?page=<%= page-1 %>">上一页</a>&nbsp;&nbsp; <a href="?page=<%= page+1 %>">下一页</a>&nbsp;&nbsp; <a href="?page=<%= n %>">尾页</a>&nbsp;&nbsp;转到第<Input type="text" name="page" size="3" maxlength="5" value="<%= page %>" onKeyPress="if (event.keyCode==13) window.location='?page='+this.value+'';">页</td>
  </tr>
</table>
<%
end sub

sub moves()
dim id,idd,i
id=Trim(Request.Form("checkbox"))
if id&""="" then
    i=0
else
	idd=id&","
	idd=split(idd,",")
	i=ubound(idd)
end if
%>
<table class="tableBorder" cellspacing="1" cellpadding="2" width="96%" align="center" border="0">
  <tr>
    <th height="25" colspan="2" align="left">批量转移问题</th>
  </tr>
  <form action="?act=moved" method="post" name="frm">  
  <tr>
    <td colspan="2" class="TableRow1"><font color="#008800">&nbsp;确认将上页所选 <font color="#FF0000"><b><%= i %></b></font> 条问题转移到以下分类</font></td>
    </tr>
  <tr>
    <td align="right" class="TableRow2"><strong>选择转向分类：
      <input name="id" type="hidden" id="id" value="<%= id %>">
    </strong></td>
    <td class="TableRow2">
    <select name="select1" size="12" id="select1" style="width:88px" onChange="searchlist2(this.form);">
    </select>  
		<script language="JavaScript">
			searchinit1("", 0);
		</script>
      <select name="select2" size="12" id="select2" style="width:88px" onChange="searchlist3(this.form);">
      </select>
	    <script language="JavaScript">
			searchinit2("", 0);
		</script>
      <select name="select3" size="12" id="select3" style="width:88px" onChange="searchlist4(this.form);">
      </select>
	    <script language="JavaScript">
			searchinit3("", 0);
		</script>
      <select name="select4" size="12" id="select4" style="width:88px">
      </select>
		<script language="JavaScript">
			searchinit4("", 0);
		</script>    </td>
  </tr>
  <tr>
    <td class="TableRow1">&nbsp;</td>
    <td class="TableRow1"> 
     <input type="submit" name="button" id="button" value="确定转移">
     &nbsp; <input type="button" name="button11" id="button11" value="取消返回" onClick="history.go(-1)"></td>
  </tr>
  </form>
</table>
<%
end sub

Function ShowUser(uid)
Dim rs
  set rs=conn.execute("select userid,LastIP from "&predb&"user where id="&uid)
  If rs.bof and rs.eof then
  ShowUser="用户被删除"
  Else
  ShowUser="<a href=""../user/userinfo.asp?id="&uid&""" target=""_blank"">"&rs(0)&"</a>"
  End IF
  set rs=nothing
End Function

Function ShowUser2(uid)
Dim rs
  set rs=conn.execute("select userid,LastIP from "&predb&"user where id="&uid)
  If rs.bof and rs.eof then
  ShowUser2="<font color=""#999999"">用户被删除</font>"
  Else
  ShowUser2="<a href=""admin_user.asp?act=change&id="&uid&""">"&rs(0)&"</a> <font color=""#999999"">("&rs("LastIP")&")</font>"
  End IF
  set rs=nothing
End Function

Function AskClass(num)
IF isobject(application("myClassxml"))=false Then call askD.DoClassXml

if num<>0 then

Dim PostListStr,PStr
dim Rexml,Node,Topic,fstr,nx,ParentStr,classname,xs
set Rexml=application("myClassxml")
set Node=Rexml.documentElement.selectSingleNode("row[@classid="&num&"]")
    ParentStr=Node.selectSingleNode("@parentstr").Text
	classname=Node.selectSingleNode("@classname").Text
set node=nothing
    ParentStr=ParentStr&","
	ParentStr=split(ParentStr,",")

	  
   for each PStr in ParentStr
   if PStr="" then PStr=0
   if clng(PStr)>0 then
   set xs=Rexml.documentElement.selectSingleNode("row[@classid="&pstr&"]")
       PostListStr=PostListStr&"<a href=""list.asp?classid="&PStr&""">"&xs.selectSingleNode("@classname").Text&"</a> &raquo; "
   set xs=nothing
   end if
   next
	   PostListStr=PostListStr&"<a href=""list.asp?classid="&num&""">"&ClassName&"</a>"&vbcrlf
set Rexml=nothing

end if

   AskClass=PostListStr
End Function
%>
<br>
</body>
</html>
