<%
'option explicit
dim startime,conn,connstr,db,rs,rs_s,rs_s1
startime=timer()
db="riwoniang/data.asa"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
conn.Open connstr
%>
<%
dim webname,webemail,dizhi,youbian,dianhua,copyright,webbanner,weblogo,weburl,gonggao
set rs=server.CreateObject("adodb.recordset")
rs.Open "select webname,webemail,dizhi,youbian,dianhua,copyright,gonggao,weblogo,weburl,webbanner from shop_config",conn,1,1
webname=trim(rs("webname"))
webemail=trim(rs("webemail"))
dizhi=trim(rs("dizhi"))
youbian=trim(rs("youbian"))
dianhua=trim(rs("dianhua"))
copyright=trim(rs("copyright"))
weblogo=trim(rs("weblogo"))
webbanner=trim(rs("webbanner"))
weburl=trim(rs("weburl"))
gonggao=trim(rs("gonggao"))
rs.Close
set rs=nothing

Rem 过滤HTML代码
function HTMLEncode(fString)
if not isnull(fString) then
    fString = replace(fString, ">", "&gt;")
    fString = replace(fString, "<", "&lt;")

    fString = Replace(fString, CHR(32), "&nbsp;")
    fString = Replace(fString, CHR(9), "&nbsp;")
    fString = Replace(fString, CHR(34), "&quot;")
    fString = Replace(fString, CHR(39), "&#39;")
    fString = Replace(fString, CHR(13), "")
    fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
    fString = Replace(fString, CHR(10), "<BR> ")

    'fString=ChkBadWords(fString)
    HTMLEncode = fString
else
   HTMLEncode=fstring
end if
end function

Rem 过滤SQL非法字符
function checkStr(str)
	if isnull(str) then
		checkStr = ""
		exit function 
	end if
	checkStr=replace(str,"'","''")
end function

Rem 判断数字是否整形
function isInteger(para)
       on error resume next
       dim str
       dim l,i
       if isNUll(para) then 
          isInteger=false
          exit function
       end if
       str=cstr(para)
       if trim(str)="" then
          isInteger=false
          exit function
       end if
       l=len(str)
       for i=1 to l
           if mid(str,i,1)>"9" or mid(str,i,1)<"0" then
              isInteger=false 
              exit function
           end if
       next
       isInteger=true
       if err.number<>0 then err.clear
end function
%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/main.css" rel="stylesheet" type="text/css">
<base target="_top">
<title>盐城百姓网--盐城人的网上家园</title>
</head>
<body leftMargin=0 topMargin=0 
marginheight="0" marginwidth="0">
<table width="320" border="0" align="center" cellSpacing="0" cellPadding="0"> 
<%set rs=server.createobject("adodb.recordset")
		rs.open "select Top 8 * from shop_books where bestbook=1 order by bookid desc",conn,1,1
		if rs.recordcount=0 then 
		%> <tr> <%
		else
		while not rs.eof
%> <%
					set rs2=server.createobject("adodb.recordset")
					rs2.open "select * from shop_nclass where nclassid="&rs("nclassid"),conn,1,1
					if rs2.recordcount>0 then
					%> <td width="187" height="24"><font color="#009900">&nbsp;<img src="images/ring01.gif" width="9" height="9"> 
<%if rs.eof then%> <%else%> <%response.write "<a href=list.asp?id="&rs("bookid")&" target=_blank>" 
				if len(trim(rs("bookname")))>15 then 
				response.write left(trim(rs("bookname")),13)&".." 
				else 
				response.write trim(rs("bookname")) 
				end if 
				response.write "</a>" 
				%> <%rs.movenext%> <%end if%> </font> </td><td width="129" height="24" align="center">  
<font color="#009900"> 
<%response.write "<a href=class.asp?lx=small&anid="&rs2("anclassid")&"&nid="&rs2("nclassid")&" targer=_blank>"&rs2("nclass")%> 
</font> 
<%end if
	rs2.close
	set rs2=nothing%> </td></tr> <%wend
end if%> </table>
</body>             
</html>