<!--#include file=conn.asp-->
<!--#include file="function.asp"-->
<!--#include file="config.asp"-->
<!--#include file="md5.asp"-->
<%
if not IsNumeric(request("id")) or request("id")="" then
		Response.Write ("<script>alert('友情提示!\n\参数错误!');history.back();</script>")
		Response.end
	end if
	if request("id")<>"" then
	id=CLNG(request("id"))
	end if
	rs.open"select * from reply where id="&id,conn,1,1
	if rs.eof then
	Response.Write ("<script>alert('友情提示!\n\参数错误!');history.back();</script>")
	Response.end
	end if
	wenid=rs("replyid")
	rs.close
	rs.open"select * from question where id="&wenid,conn,1,1
	if rs.eof then
	Response.Write ("<script>alert('友情提示!\n\参数错误!');history.back();</script>")
	Response.end
	else
	rs2.open"select * from person where name='"&rs("sender")&"'",conn,1,1
	touxian=rs2("touxian")
	rs2.close
	rs2.open"select * from assort where topic='"&rs("topic")&"'",conn,1,1
	shuxing=rs2("shuxing")
	rs2.close
	rs2.open"select * from class where id="&shuxing&"",conn,1,1
	topic0=rs2("topic")
	id0=rs2("id")
	rs2.close
	end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=rs("title")%>_<%=webname%></title>
<link href="iknow.css" rel="stylesheet" type="text/css">
</head>
<body class="bgbdy" topmargin="0">
<center>
<!--#include file=top.asp-->
<script>
var url = escape(location.href);

function ctlSubmit(event) {
	if (event.ctrlKey && event.keyCode == 13) {	fdf.submit()	}
}
function checkco(f,des)
{ if(f.co.value=="") {alert("请输入您的"+des); return false;}}
function limitpl(f,des)
{ if(f.co.value=="") {alert("请输入您的"+des); return false;} return limitChars(f.co,des,200);}
function checkcoAndsn(f,des)
{ if(f.co.value=="") {alert("请输入您的"+des); return false;} return limitChars(f.sn,"参考资料",60);}
function cReply(flag)
{ if (flag=="yes") {
document.getElementById('replyTB').style.display=""; }
if(flag=="no"){document.getElementById('replyTB').style.display="none"; }
location.href="#here";
}
function fixReply(flag){ setTimeout("cReply('"+flag+"')",300);}
function limitChars(obj,obj_Str,limit_len)
{
	var c = getLeftChars(obj,limit_len);
	if(c<0) 
	{
	  echo_str = obj_Str + "限定在"+limit_len+"个字以内，请缩短字数";
      alert(echo_str);
      obj.focus();
      return false;    
	}
return true;	
}
function getLeftChars(varField,limit_len) {
    var i = 0;
     var cap = limit_len*2;    
    var j=0;
   var runtime = (varField.value.length>cap)?(cap+1):varField.value.length;
    for (i = 0; i< runtime; i++) {     
     if (varField.value.charCodeAt(i) > 127 || varField.value.charCodeAt(i) == 94) {
        j=j+2;  
        } 
     else {
        j=j+1
     }   
    }  //结束FOR循环
    var leftchars = cap - j;    
    return (leftchars);
}
</script>
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
<tr> 
<td height="25" nowrap><a href="wen"><%=webname%></a> &gt; <a href="assort.asp?id=<%=id0%>&topic=<%=topic0%>"><%=topic0%></a> &gt; <a href=assort1.asp?id=<%=rs("fenleiid")%>&topic=<%=rs("topic")%>><%=rs("topic")%></a></td>                                                 
</tr>
</table>

<table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="zhtable">
        <tr> 
          <td nowrap class="bgtle"> 评论</td>
        </tr>
<tr><td class="bgcntLn"><%
rs1.open"select * from ping where replyid="&id&" order by pingtime desc",conn,1,1
  if rs1.eof then%>暂无评论!                                         
  <%else
		rs1.pagesize=25
		maxnum=rs1.recordcount
		maxpage=rs1.pagecount
		if request("p")="" then
		p=1
		else
		p=cint(request("p"))
		end if
		if p>maxpage then
		p=maxpage
		end if
		if p=0 then
		p=1
		end if
		if p<>1 then
		rs.move (p-1)*rs.pagesize
		end if
		for i=1 to rs1.pagesize
		rs3.open"select * from person where name='"&rs1("pingname")&"'",conn,1,1
	touxianp=rs3("touxian")
	rs3.close
		%>
<a name="15555272"><div class="f14"><%=ubb(rs1("ping"))%></div>
<div align="right"><span class="f12gy">评论者：</span>	 </a>	<a href=showperson.asp?name=<%=rs1("pingname")%> target=_blank><%=rs1("pingname")%></a> - <a href="help.asp#n5" target=_blank><%=touxianp%></a> </div>                                                                            
<div style="padding-top:5px;padding-bottom:5px;"><hr size=1 color=#999999></div>
<%rs1.movenext
		if rs1.eof then exit for
		next%>
<div align=center class=f14>评论数:<font color=red><%=maxnum%></font> | 每页数:<font color=green><%=rs1.pagesize%></font> | 总页数:<font color=green><%=maxpage%></font> | 当前页:<font color=red><%=p%></font>                                                                                                                                                                                      
		  <a href=ping.asp?id=<%=id%>&p=1>首页</a>                                                                                                                                                                                       
		  <a href=ping.asp?id=<%=id%>&p=<%=p-1%>>上页</a>                                                                                                                                                                                       
		  <a href=ping.asp?id=<%=id%>&p=<%=p+1%>>下页</a>                                                                                                                                                                                       
		  <a href=ping.asp?id=<%=id%>&p=<%=maxpage%>>尾页</a></div>                                                                            
</td></tr>
</table>
<%
rs1.close
end if%>
  <br>
  <%
  if request("submitping")="提交评论" then
	  if session("person")="" then
	  response.redirect "login.asp"
	  end if
	  if session("person")=rs("jieuser") then
	  response.write"<script>alert('您不能对自己的答案进行评价!');history.back();</script>"
	  end if
	  if request("co")="" then
	  response.write"<script>alert('评论内容不能为空!');history.back();</script>"
	  else
	  ping=request("co")
	  rs3.open"select * from ping where replyid="&id&" and pingname='"&session("person")&"'",conn,1,1
	  if not rs3.eof then
	  response.write"<script>alert('您已经发表过对该最佳答案的评论!');history.back();</script>"
	  rs3.close
	  else
	  rs3.close
	  rs3.open"select * from ping",conn,1,3
	  rs3.addnew
	  rs3("pingname")=session("person")
	  rs3("ping")=ping
	  rs3("replyid")=id
	  rs3("pingtime")=now
	  rs3.update
	  rs3.close
	  rs3.open"select * from person where name='"&session("person")&"'",conn,1,3
		  rs3("replynum")=rs3("replynum")+pldf
		  rs3("jifen")=rs3("jifen")+pldf
		  if rs3("jifen")+pldf<fen1 then
		  rs3("touxian")=""&ji1&" 一级"
		  elseif rs3("jifen")+pldf>=fen1 and rs3("jifen")+pldf<fen2 then
		  rs3("touxian")=""&ji1&" 一级"
		  elseif rs3("jifen")+pldf>=fen2 and rs3("jifen")+pldf<fen3 then
		  rs3("touxian")=""&ji2&" 二级"
		  elseif rs3("jifen")+pldf>=fen3 and rs3("jifen")+pldf<fen4 then
		  rs3("touxian")=""&ji3&" 三级"
		  elseif rs3("jifen")+pldf>=fen4 and rs3("jifen")+pldf<fen5 then
		  rs3("touxian")=""&ji4&" 四级"
		  elseif rs3("jifen")+pldf>=fen5 and rs3("jifen")+pldf<fen6 then
		  rs3("touxian")=""&ji5&" 五级"
		  elseif rs3("jifen")+pldf>=fen6 and rs3("jifen")+pldf<fen7 then
		  rs3("touxian")=""&ji6&" 六级"
		  elseif rs3("jifen")+pldf>=fen7 and rs3("jifen")+pldf<fen8 then
		  rs3("touxian")=""&ji7&" 七级"
		  elseif rs3("jifen")+pldf>=fen8 and rs3("jifen")+pldf<fen9 then
		  rs3("touxian")=""&ji8&" 八级"
		  elseif rs3("jifen")+pldf>=fen9 and rs3("jifen")+pldf<fen10 then
		  rs3("touxian")=""&ji9&" 九级"
		  elseif rs3("jifen")+pldf>=fen10 then
		  rs3("touxian")=""&ji10&" 十级"
		  end if
		  rs3.update
		  rs3.close
		  response.write"<script>alert('评论发表成功!');window.navigate('ping.asp?id="&id&"');</script>"	  
		  end if
	  end if
	  end if
	  rs3.open"select * from ping where replyid="&id&" and pingname='"&session("person")&"'",conn,1,1
	  if rs3.eof then 
%>
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <form action="ping.asp" method="post" onSubmit = "return limitpl(this,'评论内容');">
<input type="hidden" name="id" value="<%=id%>">
		<tr> 
          <td class="bgcntBor4"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
              <tr valign="top"> 
                <td width="22%" nowrap class="f14">发表评论:</td>
                <td width="78%"><textarea name="co" cols="50" rows="6"></textarea> 
                  <br>
                  回答字数200字以内 </td>
              </tr>
            </table>
            <br> <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
              <tr> 
                <td width="22%" class="f14">&nbsp;</td>
                <td width="78%"><input type="submit" name="submitping" value="提交评论" class="bnsrh">
                </td>
              </tr>
            </table></td>
        </tr></form>
      </table>
<%rs3.close
end if%>
</td>
<td width="180" valign="top" style="padding-left:10px;">
<script language="JavaScript" type="text/JavaScript">
//document.getElementById("fixTB").style.display="none";
function fixReply(tit,ref,rid)
{
var _sn=document.myform.sn;
var _co=document.myform.co;
var _rid=document.myform.rid;
var _tit=document.getElementById(tit).innerHTML;
var _ref=document.getElementById(ref).innerHTML;
document.getElementById("fixTB").style.display="";
_co.value=_tit;
_sn.value=_ref;
_rid.value=rid;
_co.focus();
location.href="#gohere";
}
</script>
<table border="0" align="right" cellpadding="0" cellspacing="0">
<tr><td width="170" valign="top" class="padL12">
 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="magBtm12">
<tr> 
<td class="bgtle" nowrap><%if session("person")<>"" then%>用户信息<%else%>用户登录<%end if%></td>
</tr>
<tr> 
 <td class="bgcntBor3">
 <%if request("login")="登录" then
 jiance=request("name")
if InStr(jiance,"or")<>0 or InStr(jiance,"'")<>0 or InStr(jiance,"`")<>0 or InStr(jiance,"=")<>0 or InStr(jiance,"-")<>0 or InStr(jiance,",")<>0 or InStr(jiance,"and")<>0 then 
Response.Write "<script language=JavaScript>{alert('用户名非法！');history.back();}</script>"
Response.End 
end if
		if not IsNumeric(request("verifycode")) then
		Response.Write ("<script>alert('友情提示!\n\n验证编码必须是数字!');history.back();</script>")
		Response.end
	end if
	if (int(session("SafeCode"))<>int(request("verifycode"))) then
		Response.Write ("<script>alert('友情提示!\n\n验证编码输入错误!');history.back();</script>")
		Response.end
	end if
	  if request("name")="" then
	  response.write"<script>alert('用户名不能为空!');history.back();</script>"
	  elseif request("pwd")="" then
	  response.write"<script>alert('密码不能为空!');history.back();</script>"
	  else
	  name=request("name")
	  pwd=request("pwd")
	  rs2.open"select * from person where name='"&name&"' and pwd='"&md5(pwd)&"'",conn,1,1
	  if rs2.eof then
	  response.write"<script>alert('用户名或密码错误!');history.back();</script>"
	  else
	  rs3.open"select * from person where name='"&name&"'",conn,1,3
	  rs3("logintime")=now
	  rs3.update
	  rs3.close
	  session("person")=name
	  %>
	  <%end if
	  rs2.close
	  end if
	  end if%>
	  
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="zhtable"><%if session("person")<>"" then%>
              <tr> 
                <td  class="f14">您好：<%=session("person")%> </td>
              </tr>
              <tr> 
                <td><%rs2.open"select * from person where name='"&session("person")&"'",conn,1,1%> 
                  <a href="help.asp#n5" target=_blank><%=rs2("touxian")%></a> ( <%=rs2("jifen")%> )</td>                                                                                            
              </tr>
      </table>
<table cellSpacing=0 cellPadding=0 width="100%" border=0>
  <tr>
    <td height=22>&#8226; <a href="user.asp?lei=mywen" target=_blank>我的提问</a></td>                                                                                            
    <td>&#8226; <a href="user.asp" target=_blank>个人中心</a></TD>                                                                                            
  </tr>
  <tr>
    <td>&#8226; <a href="user.asp?lei=myda" target=_blank>我的回答</a></td>                                                                                            
    <td>&#8226; <a href="exit.asp">退出</a><%rs2.close%></td>                                                                                       
  </tr>
  <%end if%><%if session("person")="" then%><tr><form method=post action=ping.asp?id=<%=id%>><td align="center" valign="top">
	<p>用&nbsp;&nbsp;&nbsp;&nbsp;户: <input name="name" type="text" id="name" size="12"><br>密&nbsp;&nbsp;&nbsp;&nbsp;码: <input name="pwd" type="password" id="pwd" size="12"><br>验证码:<input type="text" size=3 maxlength=4 name=verifycode> <%Call GetSafeCode%><br><FONT color=#666666>(请输入图中数字)</FONT><br><input name="login" type="submit" id="login" value="登录">&nbsp;&nbsp;                                                                                  
    <a href="reg.asp">注册</a>
</td></form><%end if%></tr>
</table>

                </table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> <td class="bgtle" nowrap>同类热点问题</td></tr>
<tr> <td class="bgcntLn">
<%
rs2.open"select top 5 * from question where fenleiid="&rs("fenleiid")&" order by views desc",conn,1,1
%>
	<table width="152" border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed;word-wrap:break-word;"><%while NOT rs2.EOF%>
	<tr><td width=10 valign="top">&#8226; </td>
<td><a href="showquestion.asp?id=<%=rs2("id")%>" target="_blank"><%=rs2("title")%></a></td></tr>
<%
rs2.movenext
wend
rs2.close
%>
	<tr><td>&nbsp;</td><td height="22" ><a href="assort1.asp?id=<%=rs("fenleiid")%>&topic=<%=rs("topic")%>" class="lmore">更多&gt;&gt;</a></td></tr></table>
</td></tr></table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> <td class="bgcntBor4"><%rs2.open"select top 5 * from gonggao where flid=3 order by time desc",conn,1,1
                  if rs2.eof then%>暂时没有公告<%else
	  while not rs2.eof
	  %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=rs2("text")%><hr size="1" color="#999999">
<%rs2.movenext
	  wend
	  end if
	  rs2.close
	  rs.close
	  %>
</td>
</tr></table>
</td></tr></table>
</center>

</table>
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0" style="clear:both;">  <tr>    <td height="30" align=center><!--#include file=end.asp--></td> 
  </tr>
</table>

</body>
