<!--#include file="conn.asp"-->
<!--#include file="inc/function.asp"-->
<%
dim rs,sql,i
set rs=server.CreateObject("adodb.recordset")
sql ="Select * from kw_checkday"
rs.open sql,conn,1,3
if DateDiff("d",rs("checkday"),now())>=1 then '一天检查一次过期
   rs("checkday")=now()
   rs.update
   rs.close
   set rs=nothing

    set rs=server.CreateObject("adodb.recordset")
    sql ="Select * from kw_wt where gq=1 and zt<>3"
    rs.open sql,conn,1,3
      do while not rs.eof 
          if DateDiff("d",rs("twtime"),now())>=20 then
          rs("gq")=2
          rs.update
		        dim rs1,sql1
		     	set rs1=server.CreateObject("adodb.recordset")
                sql1 ="Select * from kw_user where username='"&rs("userid")&"'"
                rs1.open sql1,conn,1,3
	            rs1("jifen")=rs1("jifen")-50
				   if rs1("jifen")<0 then
				     rs1("jifen")=0
				   end if
	            rs1.update
	            rs1.close
                set rs1=nothing
          end if
      rs.movenext
      loop
	  rs.close
	  set rs=nothing 
dim show_name,show
    set rs=server.CreateObject("adodb.recordset")
    sql ="Select * from kw_wt where gq=2 and checkp<>1"
    rs.open sql,conn,1,3
	
do while not rs.eof
	show_name=rs("wt_filename")
	show=ReadTemplate("template/show_temp.html")
	show=replace(show,"{$siteinfo}",rs("bt"))
	show=replace(show,"{$daohang}",daohang())
	show=replace(show,"{$show_wt}",show_wt())
	            dim rs2,sql2
			    set rs2=server.CreateObject("adodb.recordset")
                sql2 ="Select * from kw_hd where hdques='"&rs("wt_filename")&"'"
                rs2.open sql2,conn,1,1
	        show=replace(show,"{$hd_count}",rs2.recordcount)
			    rs2.close
				set rs2=nothing
	
	show=replace(show,"{$wt_filename}",show_name)
	show=replace(show,"{$show_hd}",show_hd())
	show=replace(show,"{$show_best}",show_best())
	Call BuildFile(Server.MapPath("show/"&show_name),show)
	rs("checkp")=1
	rs.update
rs.movenext
loop
rs.close
set rs=nothing  
	  
end if

closedb	

Function show_best()
dim rs,sql
set rs=server.CreateObject("adodb.recordset")
sql ="Select * from kw_hd where hdques='"&show_name&"' and zt='2'"
rs.open sql,conn,1,1
if rs.recordcount<>0 then
show_best="<table width=""100%""  border=""0"" cellspacing=""0"" cellpadding=""0"" class=""table_best"">"&vbcrlf
show_best=show_best&"<tr>"&vbcrlf
show_best=show_best&"<td class=""bg_best"">&nbsp;<img src=""../../images/cn_point.gif"">&nbsp;最佳答案</td>"&vbcrlf
show_best=show_best&"</tr>"&vbcrlf
show_best=show_best&"<tr>"&vbcrlf
show_best=show_best&"<td>"&vbcrlf
show_best=show_best&"<table width=""94%""  border=""0"" cellspacing=""0"" cellpadding=""0"">"&vbcrlf
show_best=show_best&"<tr>"&vbcrlf
show_best=show_best&"<td width=""2%"" rowspan=""4"">&nbsp;</td>"&vbcrlf
show_best=show_best&"<td width=""98%"" height=""60""><font style=""font-size:14"">"&rs("wtans")&"</font></td>"&vbcrlf
show_best=show_best&"<tr>"&vbcrlf
show_best=show_best&"<td><hr color=""#666666"" align=""center"" width=""96%"" size=""1""></td>"&vbcrlf
show_best=show_best&"</tr>"&vbcrlf
show_best=show_best&"</table>"&vbcrlf
show_best=show_best&"</td></tr>"&vbcrlf
show_best=show_best&"</table>"&vbcrlf
show_best=show_best&"<table width=""100%""  border=""0"" cellspacing=""0"" cellpadding=""0"">"&vbcrlf
show_best=show_best&"<tr>"&vbcrlf
show_best=show_best&"<td height=""8""></td>"&vbcrlf
show_best=show_best&"</tr>"&vbcrlf
show_best=show_best&"</table>"&vbcrlf
end if
rs.close
set rs=nothing
End Function

Function show_hd()
dim rs,sql,i,str
set rs=server.CreateObject("adodb.recordset")
sql ="Select * from kw_hd where hdques='"&show_name&"' and zt='1' order by id desc"
rs.open sql,conn,1,1
for i=1 to rs.recordcount
str="<table width=""94%""  border=""0"" cellspacing=""0"" cellpadding=""0"">"&vbcrlf
str=str&"<tr>"&vbcrlf
str=str&"<td width=""2%"" rowspan=""4"">&nbsp;</td>"&vbcrlf
str=str&"<td width=""98%"" height=""60""><font style=""font-size:14"">"&rs("wtans")&"</font></td>"&vbcrlf
str=str&"</tr>"&vbcrlf
str=str&"<tr>"&vbcrlf
str=str&"<td><hr color=""#666666"" align=""center"" width=""96%"" size=""1""></td>"&vbcrlf
str=str&"</tr>"&vbcrlf
str=str&"</table>"&vbcrlf
show_hd=show_hd&str
rs.movenext
next
rs.close
set rs=nothing
End Function

Function Daohang()
Daohang="<a href=""../../index.html"">首页</a> → <a href=""../../list.asp?dl="&rs("dalei")&""">"&rs("dalei")&"</a> → <a href=""../../list.asp?dl="&rs("dalei")&"&xl="&rs("xiaolei")&""">"&rs("xiaolei")&"</a>"
End Function

Function Show_wt()
Show_wt="<table width=""98%""  border=""0"" cellspacing=""0"" cellpadding=""0"">"&vbcrlf
Show_wt=Show_wt&"<tr>"&vbcrlf
Show_wt=Show_wt&"<td><font style=""font-size:14""><b>"&rs("bt")&"</b></font></td>"&vbcrlf
Show_wt=Show_wt&"</tr>"&vbcrlf
Show_wt=Show_wt&"<tr>"&vbcrlf
Show_wt=Show_wt&" <td height=""26""><img src=""../../images/jf_point.gif"">&nbsp;<font color=""#ff5400"">悬赏分："&rs("xsf")&"</font>&nbsp;&nbsp;<font color=#000000>已经过期</font>&nbsp;&nbsp;&nbsp;<font color=#666666>过期时间"&FormatDateTime(now(),vbLongDate)&"</font></td>"&vbcrlf
Show_wt=Show_wt&"</tr>"&vbcrlf
Show_wt=Show_wt&"<tr>"&vbcrlf
Show_wt=Show_wt&"<td><font style=""font-size:14"">"&rs("nr")&"</font></td>"&vbcrlf
Show_wt=Show_wt&"</tr>"&vbcrlf
Show_wt=Show_wt&"<tr>"&vbcrlf
Show_wt=Show_wt&"<td height=""40"">&nbsp;&nbsp;&nbsp;&nbsp;<input type=""button"" name=""whd"" value=""我来回答"" onClick=""document.location.href='#hd'"" class=""input1""></td>"&vbcrlf
Show_wt=Show_wt&"  </tr></table>"&vbcrlf
End Function
%>