<%
'option explicit
dim startime,conn,connstr,db,rs,rs_s,rs_s1
startime=timer()
db="shop/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">
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select top 7 bookid,bookname,liulancount from shop_books order by liulancount desc",conn,1,1%> <table width="280" border="0" cellspacing="0" cellpadding="0"> 
<tr> <td valign="top" ><table border="0" cellspacing="0" cellpadding="0" align="center"> 
<tr> <td> <table border="0" cellspacing="0" cellpadding="0" align="center" width="280"> 
<tr> <td> <%set rs=server.CreateObject("adodb.recordset")
		rs.open "select Top 7 * from shop_books where newsbook=1 order by bookid desc",conn,1,1
		if rs.eof and rs.bof then
		response.write "<center><br><font color=red size=2>对不起，暂无新品！</font></font>"
		'response.End
		else
		%> <table cellspacing=0 cellpadding=0 border=0 width="280" ALIGN="CENTER"> 
<%
		dim i_1,i_count
		i_1=int((rs.recordcount+1)/3)
		if i_1>8 then 
		i_1=8
		end if
		'response.write i_1
		for i_count=1 to i_1%> <tr><td width="34%" valign=top><TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0"> 
<TR> <TD WIDTH="34%"><TABLE WIDTH="85" BORDER="0" CELLPADDING=0 CELLSPACING=0 ALIGN="CENTER" > 
<TR> <TD WIDTH="80" ALIGN="center" VALIGN="TOP"><TABLE CELLSPACING=0 CELLPADDING=0 WIDTH=80 BORDER=0 ALIGN="center"> 
<TBODY> <TR> <TD ALIGN=center VALIGN="MIDDLE"> <%if rs("bookpic")="" then 
response.write "<div align=center><a href=shop/list.asp?id="&rs("bookid")&" target=_blank><img src=shop/images/emptybook.gif width=75 height=75 border=0></a></div>"
else%> <A HREF=shop/list.asp?id=<%=rs("bookid")%> TARGET=_blank><IMG SRC="shop/<%=trim(rs("bookpic"))%>"  WIDTH=75 BORDER=0 HEIGHT="75"></A> 
<%end if%> </TD></TR> </TBODY> </TABLE></TD></TR><TR><TD WIDTH="100%" HEIGHT="35" ALIGN="center" VALIGN="MIDDLE" BGCOLOR="#F7FFEF"><FONT COLOR="#999999"><%response.write "<a class=a4 href=shop/list.asp?id="&rs("bookid")&" target=_blank><font color=#FF6600>"
				if len(trim(rs("bookname")))>5 then
				response.write left(trim(rs("bookname")),5)&""
				else
				response.write trim(rs("bookname"))
				end if
				response.write "</font></a>"
				%></FONT></TD></TR>    
</TABLE><%rs.movenext%></TD></TR> </TABLE></td><td width="33%" valign="top" >    
<%if rs.eof then%> <%else%> <table width="100%" border="0" cellspacing="0" cellpadding="0">    
<tr> <td><table width="85" cellpadding=0 cellspacing=0  ALIGN="CENTER">    
<td width="100%" align="center" VALIGN="TOP"><TABLE CELLSPACING=0 CELLPADDING=0 WIDTH=80 BORDER=0 ALIGN="center">    
<TBODY> <TR> <TD ALIGN=center VALIGN="MIDDLE"> <%if rs("bookpic")="" then    
response.write "<div align=center><a href=shop/list.asp?id="&rs("bookid")&" target=_blank><img src=shop/images/emptybook.gif width=75 height=75 border=0></a></div>"   
else%> <A HREF=shop/list.asp?id=<%=rs("bookid")%> TARGET=_blank><IMG SRC="shop/<%=trim(rs("bookpic"))%>"  WIDTH=75 BORDER=0 HEIGHT="75"></A>    
<%end if%> </TD></TR> </TBODY> </TABLE></td><TR><td width="80" align="center" HEIGHT="35" VALIGN="MIDDLE" BGCOLOR="#F7FFEF"><FONT COLOR="#999999"><%response.write "<a class=a4 href=shop/list.asp?id="&rs("bookid")&" target=_blank><font color=#FF6600>"   
				if len(trim(rs("bookname")))>5 then   
				response.write left(trim(rs("bookname")),5)&""   
				else   
				response.write trim(rs("bookname"))   
				end if   
				response.write "</font></a>"   
				%></FONT></td></tr>    
</table></td></tr> </table><%rs.movenext%> <%end if%> </td><td width="33%" valign="top" ><%if rs.eof then%>    
<%else%> <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0"> <TR>    
<TD><TABLE WIDTH="85" CELLPADDING=0 CELLSPACING=0  ALIGN="CENTER">    
<TD WIDTH="80" ALIGN="center" VALIGN="TOP"><TABLE CELLSPACING=0 CELLPADDING=0 WIDTH=80 BORDER=0 ALIGN="center">    
<TBODY> <TR> <TD ALIGN=center VALIGN="MIDDLE"> <%if rs("bookpic")="" then    
response.write "<div align=center><a href=shop/list.asp?id="&rs("bookid")&" target=_blank><img src=shop/images/emptybook.gif width=75 height=75 border=0></a></div>"   
else%> <A HREF=shop/list.asp?id=<%=rs("bookid")%> TARGET=_blank><IMG SRC="shop/<%=trim(rs("bookpic"))%>"  WIDTH=75 BORDER=0 HEIGHT="75"></A>    
<%end if%> </TD></TR> </TBODY> </TABLE></TD><TR><TD WIDTH="100%" ALIGN="center" HEIGHT="35" VALIGN="MIDDLE" BGCOLOR="#F7FFEF"><FONT COLOR="#999999"><%response.write "<a class=a4 href=shop/list.asp?id="&rs("bookid")&" target=_blank><font color=#FF6600>"   
				if len(trim(rs("bookname")))>22 then   
				response.write left(trim(rs("bookname")),20)&"..."   
				else   
				response.write trim(rs("bookname"))   
				end if   
				response.write "</font></a>"   
				%></FONT></TD></TR>    
</TABLE></TD></TR> </TABLE><%rs.movenext%> <%end if%> </td></tr><%next%> <%   
rs.close   
set rs=nothing%> </table><%end if%> </td></table></td></tr> </table></td></tr>                                  
</table>               
</body>               
