%
dbpath = server.mappath("data/ibook.mdb")
connstr = "driver={microsoft access driver (*.mdb)};dbq="& dbpath
set conn = server.createobject("adodb.connection")
conn.open connstr
sql = "select * from config"
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,1,1
iadmin = rs("admin")
ipassword = rs("password")
ititle = rs("title")
ihomepage = rs("homepage")
iurl = rs("url")
imax = rs("max")
ipagesize = rs("pagesize")
itoday = rs("today")
idate = rs("date")
ibottom = rs("bottom")
iimage = rs("image")
iqqshow = rs("qqshow")
icolor1 = rs("color1")
icolor2 = rs("color2")
icolor3 = rs("color3")
rs.close
set rs = nothing
%>
<%
on error resume next
set rs = server.createobject("adodb.recordset")
sql = "select * from config"
rs.open sql,conn,1,1
if date <> idate then
rs("today") = 0
end if
rs("date") = date
rs.update
rs.close
iaction = request.form("action")
if iaction = "search" then
ikey = request.form("key")
sql = "select * from content where content like '%" & ikey & "%' order by id desc"
else
sql = "select * from content order by id desc"
end if
rs.open sql,conn,1,1
ipage = 0
if rs.pagecount > 0 then
rs.pagesize = ipagesize
ipage = request("page")
if ( ipage - rs.pagecount ) > 0 then
ipage = rs.pagecount
elseif ipage = "" or ipage < 1 then
ipage = 1
end if
rs.absolutepage = ipage
end if
sql = "select * from news order by id desc"
set srs = server.createobject("adodb.recordset")
srs.open sql,conn,1,1
do while not srs.eof
inews = inews & """" & srs("news") & " [" & srs("date") & "]"","""","
srs.movenext
loop
srs.close
set srs = nothing
%>
<%=ititle%>
<%=rs.pagecount%>页
<%=itoday%>新/<%=rs.recordcount%>条
<%
ifirst = ipage - 4
if rs.pagecount > 9 and ( rs.pagecount - ipage ) < 5 then ifirst = rs.pagecount - 9
if rs.pagecount < 10 and ( rs.pagecount - ipage ) < 5 then ifirst = 1
if ( ipage - 5 ) < 0 then ifirst = 1
%>
<%
if ipage <= 1 then
%>
<%
else
%>
<%
end if
%>
<%
for i = 1 to 10
if ifirst = rs.pagecount + 1 then exit for
if ifirst - ipage = 0 then
%>
<%=ifirst%>
<%
else
%>
<%=ifirst%>
<%
end if
ifirst = ifirst + 1
next
if i < 11 then
for j = i to 10
%>
<%
next
end if
%>
<%
if ipage - rs.pagecount = 0 then
%>
<%
else
%>
<%
end if
%>
<%
i = 0
if not rs.eof then
do while not rs.eof
i = i + 1
if i > rs.pagesize then
exit do
end if
%>
<%=rs("author")%>
主题: <%=rs("title")%>
.gif">
<%
if rs("oicq") <> "" and rs("oicq") <> 0 then
%>
">
<%
else
%>
<%
end if
%>
<%
if rs("homepage") <> "" then
%>
">
<%
else
%>
<%
end if
%>
<%
if rs("email") <> "" then
%>
">
<%
else
%>
<%
end if
%>
<%
if request.cookies("iadmin") = "admin" then
%>
">
">
<%
end if
%>
<%
if iqqshow = 1 then
if rs("oicq") <> "" and rs("oicq") <> 0 then
inumber = 9 - len(rs("oicq"))
for j = 1 to inumber
ishow = ishow & 0
next
ishow = ishow & rs("oicq")
%>
<%
end if
ishow = ""
end if
itest = rs("content")
if len(rs("title")) > 4 and left(rs("title"),5) = "【悄悄话】" and request.cookies("iadmin") <> "admin" then
itest = "这条留言是悄悄话,如果你是管理员,请登陆后再看. "
end if
%>
.gif">
<%=itest%>
<%=rs("time")%>
<%
set rrs = server.createobject("adodb.recordset")
rsql = "select * from reply where topic = " & rs("id") & " order by id desc"
rrs.open rsql,conn,1,1
if not rrs.eof or rrs.bof then
do while not rrs.eof
%>
站长回复:
<%=rrs("content")%>
<%=rrs("time")%>
<%
rrs.movenext
loop
end if
rrs.close
set rrs = nothing
%>
<%
rs.movenext
loop
end if
response.write ibottom
%>
<%
rs.close
set rs = nothing
conn.close
set conn = nothing
%>