<%

Function Friends()
Dim FHtml
Set rs=Server.CreateObject("Adodb.Recordset")
Sqltext="Select top 3 * From [Link] Where [Show]=1 Order by ID Desc"
rs.Open Sqltext,Conn,1,1
Do While Not (rs.Eof or rs.Bof)
FHtml = FHtml & "<a href=" &rs("Link")& " title=" &rs("Note")& " target='_blank'>" &rs("Name")& "</a> <br> "
rs.MoveNext
Loop
Friends=FHtml
rs.Close
Set rs=Nothing
End Function

Function ShowVote()  '首页调用投票ShowVote函数，最后输出Html串
Dim VodeCode
VodeCode ="<form name=VoteForm method=post action='Vote.asp?action=vote' target=_blank>"
Set vo=Conn.Execute("Select * From [Vote]")
   VodeCode = VodeCode & "<FONT color=#000000>" & vo("VoteTitel") & "</FONT></TD></TR>"
i = 0
Vote_Array = split(vo("Selectd"),"|")
  For i=0 To Ubound(Vote_Array)-1
  VodeCode = VodeCode & "<TR><TD height=10><input type='radio' name=sele value=" &Vote_Array(i)& ">"
  VodeCode = VodeCode & Vote_Array(i)
  Next
VodeCode = VodeCode & "</TD></TR><TR><TD height=30 vAlign=center align=middle>"
VodeCode = VodeCode & "<input type=submit name=submit value=投票 class=LoginInput>&nbsp;&nbsp;"
VodeCode = VodeCode & "<input name=submit type=button class=LoginInput onclick=window.open('vote.asp') value=查看>"
VodeCode = VodeCode & "</FORM></TD></TR>"
ShowVote=VodeCode
End Function
Function FindProd()  '首页调用产品搜索FindProd函数，最后输出Html串
Dim FindStr
FindStr = FindStr & "<FORM name=Search action='Search.asp?action=search' method=post target=_blank>"
FindStr = FindStr & "<tr><TD vAlign=center align=middle height=35>关键字 <INPUT class=css_text onmouseover=""this.style.backgroundColor='#E5F0FF'"" onmouseout=""this.style.backgroundColor=''"" size=13 name='Keyword'></TD></TR>"
FindStr = FindStr & "<TR><TD vAlign=center align=middle height=30><input type=submit name=submit value=搜索 class=LoginInput></TD></TR>" 
FindStr = FindStr & "</FORM>"
FindProd=FindStr
End Function
Function UserLogin() '首页调用用户登陆UserLogin函数，最后输出Html串
Dim LogStr
If Session("MyUserName")="" and Session("MyPassWord")="" Then
LogStr=LogStr & "<TD vAlign=center align=middle height=35>用户账号 "
LogStr=LogStr & "<INPUT class=css_text onmouseover=""this.style.backgroundColor='#E5F0FF'"" onmouseout=""this.style.backgroundColor=''"" size=13 name=username>"
LogStr=LogStr & "</TD></TR><TR>" 
LogStr=LogStr & "<TD vAlign=center align=middle height=25>用户密码 "
LogStr=LogStr & "<INPUT class=css_text onmouseover=""this.style.backgroundColor='#E5F0FF'"" onmouseout=""this.style.backgroundColor=''"" type=password size=13 name=pwd></TD></TR>"
LogStr=LogStr & "<TR>" 
LogStr=LogStr & "<TD vAlign=center align=middle height=30>" 
LogStr=LogStr & "<input type=submit name=submit value=登陆 class=LoginInput> " 
LogStr=LogStr & " &nbsp;<input name=submit type=button class=LoginInput onClick=window.document.location.href='Register.asp' value=注册></TD></TR>" 
Else
Set ss=Server.CreateObject("ADODB.RecordSet")
Sql = "Select * From [User] Where [UserName]='"&Session("MyUserName")&"'"
ss.Open Sql,Conn,1,1
If Not (ss.Eof and ss.Bof) Then
LogStr=LogStr & "<tr><td Align=center>用户：" &Session("MyUserName")& "</td></tr>"
LogStr=LogStr & "<tr><td Align=center><a href=UpUser.asp>修改资料</a></td></tr>"
LogStr=LogStr & "<tr><td Align=center><a href=UserOut.asp>退出登陆</a></td></tr>"
End if
End if 
UserLogin=LogStr
End Function
 
Function PClass()
Dim PCHtml
set rsBig=server.CreateObject("adodb.recordset")
rsBig.open "Select * From [BigClassProduct]",conn,1,3
do while not rsBig.eof
PCHtml=PCHtml & "<IMG src='ziyan/folder.gif'><a href=TProduct.asp?pro="&rsBig("Product_BigClass")&">" & rsBig("Product_BigClass") & "</a><br>"
set rsSmall=server.CreateObject("adodb.recordset")
rsSmall.open "Select * From [SmallClassProduct] Where Product_BigClassName='" & rsBig("Product_BigClass") & "'",conn,1,1
if not(rsSmall.bof and rsSmall.eof) then
do while not rsSmall.eof
PCHtml=PCHtml & "<IMG src='ziyan/page.gif'><a href='SProduct.asp?spro="&rsSmall("Product_SmallClassName")&"'>" & rsSmall("Product_SmallClassName") &"</a><br>"
rsSmall.movenext
loop
end if
rsSmall.close
set rsSmall=nothing	
rsBig.movenext
loop
rsBig.close
set rsBig=nothing
PClass=PCHtml
End Function
Function TopNews(str)
Dim NewsHtml
Set rs_news=Server.CreateObject("Adodb.Recordset")
Sqltext="Select Top 10 * From [News] Order By "&str&" Desc"
rs_news.Open Sqltext,Conn,1,1
If rs_news.Eof or rs_news.Bof Then
NewsHtml= NewsHtml & "&nbsp;没有新闻!"
Else
Do While Not (rs_news.Eof or rs_news.Bof)
NewsHtml= NewsHtml & "&nbsp;<IMG src='JaOne/article_ontop.gif'>"
ti = rs_news("Titel")
If Len(ti)>12 Then ti = Left(ti,12) & "..."
NewsHtml= NewsHtml & "&nbsp;<a href='ShowNews.asp?id=" &rs_news("News_ID")& "' title="""&rs_news("Titel")&""">" &ti& "</a>" 
'Response.Write "(" &rs_news("InfoTime")& "," &rs_news("Hits")& ")"
NewsHtml= NewsHtml & "<br>"
rs_news.MoveNext
Loop
End if
rs_news.Close
Set rs_news=Nothing
TopNews=NewsHtml
End Function
Function Joblist()
Dim JobHtml
set rs=server.createobject("adodb.recordset")
sqltext="Select Top 9 * From [Job] order by ID desc"
rs.open sqltext,conn,1,1
do while not rs.eof
JobHtml= JobHtml & "&nbsp;&nbsp;<a href='Job.asp'>" & rs("JObject") & "&nbsp;time:" & rs("JTime") & "</a><br>"
rs.Movenext 
loop
Joblist=JobHtml 
End Function
Function DownList()
Dim DHl
set rs=server.createobject("adodb.recordset")
sqltext="Select top 10 * From [DownLoad] Order By ID Desc"
rs.open sqltext,conn,1,1
do while not rs.eof
DHl = DHl & "&nbsp;<IMG src='ziyan/tp007.gif'>&nbsp;&nbsp;<a href='ShowDown.asp?id="&rs("ID")&"'>" & rs("Titel") & "</a><br>"
rs.Movenext 
loop 
DownList=DHL
End Function
Function BookList()
Dim BookHtml
Set rs=Server.CreateObject("Adodb.Recordset")
Dim Cu 
Set Cu = Conn.ExeCute("Select IsCm From [index] where id =1")
If Cu(0)=1 Then
Sql="Select Top 7 * From [Book] where Mcheck=1 Order by ID desc"
Else
Sql = "Select Top 7 * From [Book] Order by ID desc"
End if
rs.Open Sql,Conn,1,1
Do While Not rs.Eof
BookHtml = BookHtml & "<font face=wingdings color=#FFAA39><B>1</B></FONT> <font color=green>[time:"&rs("Time")&"]</font> <a href='BookShow.asp?id="&rs("ID")&"'>"&Server.HtmlEncode(rs("Title"))&"</a> (By:"&rs("Name")&" Reply:"&rs("Reply")&")<br>"
rs.MoveNext
Loop
BookList=BookHtml
End Function
%>
