单文件的ASP文章管理系统

今天在看到这篇单文件的ASP文章管理系统马上自己演示了一遍,此程序使用Excel,第一次运行会自动创建Execl数据文件。

 演示:http://shui.com.ru/a/
把下面的代码复制保存到index.asp就可运行了,登陆的默认用户名和密码是admin

 程序代码

<%@codepage=936 language=LiveScript%>
<%KaiShi=(new Date()).getTime();
DataFile="im286.xls";
db=Server.MapPath(DataFile);
FileName=""+Request.ServerVariables("URL");
FileName=FileName.replace(/(.*)///g,"");
conn=Server.CreateObject("ADODB.Connection");
rs=Server.CreateObject("ADODB.RecordSet");
connstr="Driver={Microsoft Excel Driver (*.xls)};DBQ="+db+";ReadOnly=0;";
conn.Open(connstr);
Response.Addheader("Content-Type","text/html;charset=gbk");
try{sql="select * from Copyright";
rs.Open(sql,conn);
WangZhan=rs(0)+"";
WangZhi=rs(1)+"";
rs.Close();}
catch(e){sql="Create table Article(BH int,BiaoTi varchar(255),NeiRong memo,ZuoZhe varchar(20),LaiYuan varchar(255),RiQi varchar(14),DianJi int,FenLei varchar(40),ShanChu bit)";
conn.Execute(sql);
sql="Create table Copyright(ZhanMing varchar(40),WangZhi varchar(255))";
conn.Execute(sql);
sql="Insert Into Copyright values('没有设置','res://mshtml.dll/about.moz')";
conn.Execute(sql);
sql="Create table User(BH int,YongHu varchar(10),MiMa varchar(20),QuanXian bit,ShanChu bit)";
conn.Execute(sql);
sql="Insert into User values(0,'admin','admin',1,0)";
conn.Execute(sql);
Response.Addheader("refresh","3;url='javascript:alert(/"Database has been created successfully.//n//nthe default User and Password are admin./")'");
WangZhan="没有设置",
WangZhi="res://mshtml.dll/about.moz";}
MoKuai=""+Request.QueryString("模块");
FenLei=""+Request.QueryString("分类");
ID=parseInt(Request.QueryString("ID"));
if(FenLei=="undefined"){Title=MoKuai;}
else{Title=FenLei;}%><html><head>
<title><%if(Title=="undefined"){
if(isNaN(ID)){Response.Write("全部文章");}
else{sql="select BiaoTi from Article where ShanChu=0 and BH="+ID;
rs.Open(sql,conn);
if(rs.eof){Response.Write("找不到主题");}
else{Response.Write(rs(0));}
rs.Close();}}
else{Title=Title.replace("管理","文章管理");
Title=Title.replace("用户","用户管理");
Title=Title.replace("登录","用户登录");
Title=Title.replace("设置","版权设置");
Response.Write(Title);}%> - <%=WangZhan%></title>
<style>body{font:9pt 宋体}
a{text-decoration:none}
a:hover{text-decoration:underline overline;color:red}
table{font:9pt 宋体;table-layout:fixed;word-wrap:break-word;word-break:break-all}
</style><script></script></head>
<body link=123456 alink=green vlink=black scroll=auto leftmargin=0>
<table border=1 bordercolor=456789 bordercolordark=white cellpadding=0 cellspacing=0 align=center>
<tr bgcolor=abcdef><td width=770 height=21>
<table><tr><td>|<a href=<%=FileName%>><b>全部文章</b></a>|<%sql="Select distinct FenLei from Article where ShanChu=0";
rs.Open(sql,conn);
if(rs.eof){Response.Write("当前没有任何新的文章。");}
else{
while(!rs.eof){Response.Write((rs(0)+"").link(FileName+"?分类="+rs(0))+"|");
rs.MoveNext();}}
rs.Close();%>
</td><%if(Session("Access")+""=="undefined"||Session("Access")=="Guest"){%>
<td width=50 align=center>
<tt style="cursor:hand" onClick="document.all.Login.style.display='block';document.all.Login.style.left=event.x-140;document.DengLu.YongHu.focus()">登录</tt>
<div style="position:absolute;display:none" id=Login>
<table border bordercolor=black bgcolor=menu bordercolordark=menu cellpadding=0 cellspacing=0 width=150 height=123>
<tr><td bgcolor=abcdef height=27 align=center>用户登录</td></tr>
<tr><form action=<%=FileName%>?模块=登录 method=post name=DengLu>
<td align=center>
用户:<input name=YongHu size=10><dt>
密码:<input type=password name=MiMa size=10><dt>
<input type=submit value=登录>
<input type=button value=取消 οnclick="document.all.Login.style.display='none'"></td></form></tr></table></div></td><%}
else{Response.Write("<td width=60 align=center><a href="+FileName+"?模块=管理>文章管理</a></td>");}%></tr></table>
</td></tr>
<tr><td height=21>
<table><tr><td>|<%Response.Write(WangZhan.link(WangZhi));%>\<%switch(MoKuai){
case "登录":
Response.Write("用户登录");
break;
case "设置":
Response.Write("版权设置");
break;
case "用户":
Response.Write("用户管理");
break;
case "管理":
Response.Write("文章管理");
break;
default:
if(FenLei!="undefined"){Response.Write(FenLei);}
else if(!isNaN(ID)){
sql="select FenLei,BiaoTi from Article where ShanChu=0 and BH="+ID;
rs.Open(sql,conn);
if(rs.eof){Response.Write("找不到主题");}
else{LeiBie=rs(0)+"";
%><a href="<%=FileName%>?分类=<%=rs(0)%>"><%=rs(0)%></a>\<%=rs(1)%><%}
rs.Close();}
else{Response.Write("全部文章");}}%></td></tr></table>
</td></tr></table>
<%switch(MoKuai){
/*********** 登录模块 **************/
case "登录":
YongHu=Request.Form("YongHu")+"";
YongHu=YongHu.replace(/'/g,"''");
MiMa=Request.Form("MiMa")+"";
MiMa=MiMa.replace(/'/g,"''");
if(YongHu+""=="undefined"){Session("Access")="Guest";
Response.Write("<Meta http-equiv=refresh content=2;url="+FileName+"><br><center><b>您已退出登录状态。</b></center><br>");}
else{
sql="select * from User where YongHu='"+YongHu+"' and MiMa='"+MiMa+"' and ShanChu=0";
rs.Open(sql,conn);
if(rs.eof){Response.Write("<Meta http-equiv=refresh content=2;url=javascript:history.go(-1)><br><center><b>对不起,您输入的用户名或者密码有误。</b></center><br>");}
else{QuanXian=""+rs(3);
if(QuanXian=="true"){QuanXian=true;}
else{QuanXian=false;}
Session("Access")=QuanXian?"Admin":"User";
Response.Write("<Meta http-equiv=refresh content=2;url="+FileName+"?模块=管理><br><center><b>登录成功。</b></center><br>");}
rs.Close();}
break;
/*********** 文章管理 **************/
case "管理":
if(Request.QueryString("操作")+""=="删除"&&Session("Access")=="Admin"){
sql="update Article set ShanChu=1 where BH="+Request.QueryString("BH");
conn.Execute(sql);}
if(Request.QueryString("操作")+""=="恢复"&&Session("Access")=="Admin"){
sql="update Article set ShanChu=0 where BH="+Request.QueryString("BH");
conn.Execute(sql);}
if(Request.QueryString("操作")+""=="添加"){
sql="select count(*) from Article";
rs.open(sql,conn);
BH=rs(0)+"";
rs.Close();
BiaoTi=Request.Form("BiaoTi")+"";
FenLei=Request.Form("FenLei")+"";
NeiRong=Request.Form("NeiRong")+"";
ZuoZhe=Request.Form("ZuoZhe")+"";
LaiYuan=Request.Form("LaiYuan")+"";
BiaoTi=BiaoTi.replace(/'/g,"''");
FenLei=FenLei.replace(/'/g,"''");
NeiRong=NeiRong.replace(/'/g,"''");
NeiRong=NeiRong.replace(/ /g," ");
NeiRong=NeiRong.replace(//r/g,"<br>");
ZuoZhe=ZuoZhe.replace(/'/g,"''");
LaiYuan=LaiYuan.replace(/'/g,"''");
RiQi=new Date();
Nian=RiQi.getYear();
Yue=RiQi.getMonth()+1;
if(Yue<10) Yue="0"+Yue;
Ri=RiQi.getDate();
if(Ri<10) Ri="0"+Ri;
RiQi=Nian+"年"+Yue+"月"+Ri+"日";
sql="select top 1 BH from Article where ShanChu=1 order by RiQi asc";
rs.open(sql,conn);
if(!rs.eof){
sql="Update Article set BiaoTi='"+BiaoTi+"',NeiRong='"+NeiRong+"',ZuoZhe='"+ZuoZhe+"',LaiYuan='"+LaiYuan+"',RiQi='"+RiQi+"',DianJi=0,FenLei='"+FenLei+"',ShanChu=0 where BH="+rs(0);}
else{sql="insert into Article values("+BH+",'"+BiaoTi+"','"+NeiRong+"','"+ZuoZhe+"','"+LaiYuan+"','"+RiQi+"',0,'"+FenLei+"',0)";}
rs.Close();
if(Session("Access")=="User"||Session("Access")=="Admin") conn.Execute(sql);}
if(Request.QueryString("操作")+""=="修改"&&Session("Access")=="Admin"){
if(Request.Form("BH")+""!="undefined"){
BiaoTi=Request.Form("BiaoTi")+"";
FenLei=Request.Form("FenLei")+"";
NeiRong=Request.Form("NeiRong")+"";
ZuoZhe=Request.Form("ZuoZhe")+"";
LaiYuan=Request.Form("LaiYuan")+"";
BiaoTi=BiaoTi.replace(/'/g,"''");
FenLei=FenLei.replace(/'/g,"''");
NeiRong=NeiRong.replace(/'/g,"''");
NeiRong=NeiRong.replace(/ /g," ");
NeiRong=NeiRong.replace(//r/g,"<br>");
ZuoZhe=ZuoZhe.replace(/'/g,"''");
LaiYuan=LaiYuan.replace(/'/g,"''");
RiQi=new Date();
Nian=RiQi.getYear();
Yue=RiQi.getMonth()+1;
if(Yue<10) Yue="0"+Yue;
Ri=RiQi.getDate();
if(Ri<10) Ri="0"+Ri;
RiQi=Nian+"年"+Yue+"月"+Ri+"日";
sql="Update Article set BiaoTi='"+BiaoTi+"',NeiRong='"+NeiRong+"',ZuoZhe='"+ZuoZhe+"',LaiYuan='"+LaiYuan+"',RiQi='"+RiQi+"',FenLei='"+FenLei+"' where BH="+Request.Form("BH");
conn.Execute(sql);}
else{%><div style="position:absolute;top:expression((document.body.clientHeight-320)/2+body.scrollTop);left:expression((document.body.clientWidth-400)/2)" id=XiuGai>
<table border width=400 border bordercolor=black bordercolordark=white cellpadding=0 cellspacing=0>
<tr bgcolor=000070>
<th align=center height=20><font color=white>修改文章</font></th></tr>
<tr bgcolor=menu><td>
<table><tr><%sql="select * from Article where BH="+Request.QueryString("BH");
rs.Open(sql,conn);
BH=rs(0)+"";
BiaoTi=rs(1)+"";
NeiRong=rs(2)+"";
ZuoZhe=rs(3)+"";
LaiYuan=rs(4)+"";
FenLei=rs(7)+"";
rs.Close();
BiaoTi=BiaoTi.replace(/"/g,""");
NeiRong=NeiRong.replace(/<br>/n/g,"/r/n");%>
<form action=<%=FileName%>?模块=管理&操作=修改 method=post><input type=hidden name=BH value=<%=BH%>>
<td width=77 align=center>文章标题</td><td><input size=41 name=BiaoTi value="<%=BiaoTi%>"></td></tr>
<tr><td align=center>所属分类</td>
<td><select οnchange="FenLei.value=value">
<option>选择分类</option>
<%sql="Select distinct FenLei from Article where ShanChu=0";
rs.Open(sql,conn);
while(!rs.eof){%><option value="<%=rs(0)%>"><%=rs(0)%></option>
<%rs.MoveNext();}
rs.Close();%>
</select>
<input name=FenLei value="<%=FenLei%>" size="20"></td></tr>
<tr><td align=center valign=top>详细内容</td><td><textarea name=NeiRong rows=10 cols=40><%=NeiRong%></textarea></td></tr>
<tr><td align=center>作者</td><td>
 <input name=ZuoZhe value="<%=ZuoZhe%>" size="20"></td></tr>
<tr><td align=center>来源</td><td><input name=LaiYuan size=41 value=<%=LaiYuan%>></td></tr>
<tr><td colspan=2 align=center><input type=button value=关闭 οnclick="XiuGai.style.display='none'">
<input type=submit value=修改></td>
</form></tr></table>
</td></tr></table></div><%}
}%><br>
<table cellpadding=0 cellspacing=0 border=1 bordercolor=456789 bordercolordark=white align=center width=770>
<tr><td bgcolor=abcdef align=center valign=top width=210><br>
<p><a href=<%=FileName%>>返回首页</a></p>
<p>文章管理</p><%if(Session("Access")=="Admin"){%>
<p><a href=<%=FileName%>?模块=用户>用户管理</a></p>
<p><a href=<%=FileName%>?模块=设置>版权设置</a></p><%}%>
<p><a href=<%=FileName%>?模块=登录>退出登录</a></p>
<br></td><td valign=top>
<table width=97% align=center><tr>
<td valign=bottom>(单击标题修改文章)</td><td align=right>
<table border style="cursor:hand" width=80 height=30 οnclick="WenZhang.style.display='block'">
<tr><td align=center>添加文章</td></tr></table>
</td></tr></table>
<table width=97% align=center border bordercolor=black bordercolordark=white cellpadding=0 cellspacing=0>
<%sql="select BH,BiaoTi,ShanChu from Article order by RiQi DESC";
rs.open(sql,conn,1);
rs.pagesize=17;
page=parseInt(Request.QueryString("页码"));
if(isNaN(page)||page<1) page=1;
if(page>rs.pagecount) page=rs.pagecount;
if(rs.eof){Response.Write("当前没有任何新的文章。");}
else{
rs.absolutepage=page;
for(C=0;C<rs.pagesize;C++){%><tr><td>◆
<a href=<%=FileName%>?模块=管理&操作=修改&BH=<%=rs(0)%>><%=rs(1)%></a></td>
<td width=31 align=center><%if(rs(2)==0){%><a href=<%=FileName%>?模块=管理&操作=删除&BH=<%=rs(0)%>>删除</a><%}
else{%><a href=<%=FileName%>?模块=管理&操作=恢复&BH=<%=rs(0)%>><font color=green>恢复</font></a><%}%></td></tr>
<%rs.MoveNext();
if(rs.eof) break;}}
pagecount=rs.pagecount;
recordcount=rs.recordcount;
rs.Close();%>
<tr><td height=30 colspan=2> <%if(page>1){%>[<a href=<%=FileName%>?模块=管理>首页</a>] [<a href=<%=FileName%>?模块=管理&页码=<%=page-1%>>上一页</a>] <%}%><%if(page!=pagecount){%>[<a href=<%=FileName%>?模块=管理&页码=<%=page+1%>>下一页</a>] [<a href=<%=FileName%>?模块=管理&页码=<%=pagecount%>>最后</a>] <%}%>跳转到第
<select οnchange="location.replace('<%=FileName%>?模块=管理&页码='+value)">
<%if(pagecount==0) pagecount=1;
for(C=1;C<=pagecount;C++){%><option value=<%Response.Write(C);
if(page==C) Response.Write(" selected")%>><%=C%></option>
<%}%></select>
页。(共 <font color=red><%=recordcount%></font> 条记录)</td></tr></table>
</td></tr></table>
<div style="position:absolute;display:none;top:expression((document.body.clientHeight-320)/2+body.scrollTop);left:expression((document.body.clientWidth-400)/2)" id=WenZhang>
<table border width=400 border bordercolor=black bordercolordark=white cellpadding=0 cellspacing=0>
<tr bgcolor=000070>
<th align=center height=20><font color=white>添加文章</font></th></tr>
<tr bgcolor=menu><td>
<table><tr>
<form action=<%=FileName%>?模块=管理&操作=添加 method=post>
<td width=77 align=center>文章标题</td><td><input size=41 name=BiaoTi></td></tr>
<tr><td align=center>所属分类</td>
<td><select οnchange="FenLei.value=value">
<option>选择分类</option>
<%sql="Select distinct FenLei from Article where ShanChu=0";
rs.Open(sql,conn);
while(!rs.eof){%><option value="<%=rs(0)%>"><%=rs(0)%></option>
<%rs.MoveNext();}
rs.Close();%>
</select>
<input name=FenLei size="20"></td></tr>
<tr><td align=center valign=top>详细内容</td>
<td><textarea name=NeiRong rows=10 cols=40></textarea></td></tr>
<tr><td align=center>作者</td><td>
 <input name=ZuoZhe value="<%=WangZhan%>" size="20"></td></tr>
<tr><td align=center>来源</td><td><input name=LaiYuan size=41 value=<%=WangZhi%>></td></tr>
<tr><td colspan=2 align=center><input type=button value=关闭 οnclick="WenZhang.style.display='none'">
<input type=submit value=添加></td>
</form></tr></table>
</td></tr></table></div><%break;
/*********** 用户模块 **************/
case "用户":
FangFa=Request.Form("TiJiao")+"";
if(FangFa=="添加"&&Session("Access")=="Admin"){
sql="Select count(*) from User";
rs.open(sql,conn);
BH=rs(0)+"";
rs.Close();
YongHu=Request.Form("YongHu");
MiMa=Request.Form("MiMa");
QuanXian=Request.Form("QuanXian");
ShanChu=Request.Form("ShanChu");
sql="insert into User values("+BH+",'"+YongHu+"','"+MiMa+"',"+QuanXian+","+ShanChu+")";
conn.Execute(sql);}
if(FangFa=="保存"&&Session("Access")=="Admin"){
BH=Request.Form("BH");
YongHu=Request.Form("YongHu");
MiMa=Request.Form("MiMa");
QuanXian=Request.Form("QuanXian");
ShanChu=Request.Form("ShanChu");
sql="update User set YongHu='"+YongHu+"',MiMa='"+MiMa+"',QuanXian="+QuanXian+",ShanChu="+ShanChu+" where BH="+BH;
conn.Execute(sql);}%><br>
<table cellpadding=0 cellspacing=0 border=1 bordercolor=456789 bordercolordark=white align=center width=770>
<tr><td bgcolor=abcdef align=center width=210><br>
<p><a href=<%=FileName%>>返回首页</a></p>
<p><a href=<%=FileName%>?模块=管理>文章管理</a></p><%if(Session("Access")=="Admin"){%>
<p>用户管理</p>
<p><a href=<%=FileName%>?模块=设置>版权设置</a></p><%}%>
<p><a href=<%=FileName%>?模块=登录>退出登录</a></p>
<br></td><td>
<table><tr>
<form action=<%=FileName%>?模块=用户 method=post οnsubmit="return confirm('确定要添加用户 '+YongHu.value+' 吗?/n/n(添加后只可禁用,不可删除。)')">
<td align=center><h3>用户管理</h3>
用户:<input size=10 name=YongHu>
密码:<input type=password name=MiMa size=10>
<select name=QuanXian><option value=0>普通用户</option>
<option value=1>管理员</option></select>
<select name=ShanChu><option value=0>启用</option>
<option value=1>禁用</option></select>
<input type=submit value=添加 name=TiJiao></td>
</form></tr>
<tr height=1 bgcolor=abcdef><td></td></tr><%sql="Select * from User order by BH desc";
if(Session("Access")=="Admin"){
rs.open(sql,conn);
while(!rs.eof){%>
<tr><form action=<%=FileName%>?模块=用户 method=post><input type=hidden name=BH value=<%=rs(0)%>>
<td align=center>用户:<input size=10 name=YongHu value=<%=rs(1)%>>
密码:<input type=password name=MiMa size=10 value=<%=rs(2)%>>
<select name=QuanXian><option value=0>普通用户</option>
<option value=1<%if(rs(3)==1) Response.Write(" selected")%> style="background:abcdef">管理员</option></select>
<select name=ShanChu><option value=0>启用</option>
<option value=1<%if(rs(4)==1) Response.Write(" selected")%> style="background:fedcba">禁用</option></select>
<input type=submit value=保存 name=TiJiao></td></form></tr>
<%rs.MoveNext();}
rs.Close();}%></table>
</td></tr></table>
<%break;
/*********** 版权设置 **************/
case "设置":
TiJiao=Request.Form("TiJiao")+"";
if(Session("Access")=="Admin"&&TiJiao=="保存"){
WangZhan=Request.Form("ZhanMing")+"";
WangZhi=Request.Form("WangZhi");
sql="update Copyright set ZhanMing='"+WangZhan+"',WangZhi='"+WangZhi+"'";
conn.Execute(sql);
Response.Write("<script>alert(/"保存成功/")</script>");}%><br>
<table cellpadding=0 cellspacing=0 border=1 bordercolor=456789 bordercolordark=white align=center width=770>
<tr><td bgcolor=abcdef align=center width=210><br>
<p><a href=<%=FileName%>>返回首页</a></p>
<p><a href=<%=FileName%>?模块=管理>文章管理</a></p><%if(Session("Access")=="Admin"){%>
<p><a href=<%=FileName%>?模块=用户>用户管理</a></p>
<p>版权设置</p><%}%>
<p><a href=<%=FileName%>?模块=登录>退出登录</a></p>
<br></td><td>
<table><tr>
<form action=<%=FileName%>?模块=设置 method=post>
<td align=center><h3>版权设置</h3>
站名:<input size=15 name=ZhanMing value=<%=WangZhan%>>
网址:<input name=WangZhi value=<%=WangZhi%> size=30>
<input type=submit value=保存 name=TiJiao></td>
</form></tr></table>
</td></tr></table>
<%break;
/*********** 默认界面 **************/
default:
ID=parseInt(Request.QueryString("ID"));
if(!isNaN(ID)){%><br>
<table width=770 cellspacing=0 cellpadding=0 border bordercolor=456789 bordercolordark=white align=center>
<tr><td>
<table width=87% align=center style="font:10.5pt/13pt 宋体;table-layout:fixed">
<tr><td style="word-wrap:break-word;word-break:break-all">
<%sql="select * from Article where ShanChu=0 and BH="+ID;
rs.Open(sql,conn);
if(!rs.eof){sql="update Article set DianJi=DianJi+1 where BH="+ID;
conn.Execute(sql);%><h3 align=center><%=rs(1)%></h3>
<center><b>作者:</b><%=rs(3)%> <b>日期:</b><%=rs(5)%><br>
<b>来源:</b><%=rs(4)%></center>
<p><%=rs(2)%></p>
<div align=right>
<%=WangZhan%><br>
<%=WangZhi%><br>
该文章被阅读了 <font color=red><%=rs(6)%></font> 次</div><%}
else{Response.Write("<center>错误:找不到该ID号的主题或该主题已经被删除。</center>");}
FenLei=""+rs(7);
rs.Close();%>
</td></tr></table>
</td></tr></table>
<table width=770 align=center><tr><td width=50% valign=top>
<table border width=100% bordercolor=456789 bordercolordark=white cellpadding=0 cellspacing=0>
<tr bgcolor=abcdef><td height=20><font color=456789>◆</font>
<b>热门文章</b></td></tr>
<tr><td><br><ul type=1><%sql="select top 7 BH,BiaoTi,RiQi,DianJi from Article where ShanChu=0 and FenLei='"+FenLei+"' order by DianJi DESC";
rs.Open(sql,conn);
C=0;
while(!rs.eof&&C<7){%>
<li><a href=<%=FileName%>?ID=<%=rs(0)%>><%=rs(1)%></a>
(<font color=green><%=rs(2)%></font>
<font color=red><%=rs(3)%></font>)</li><%C++;
rs.MoveNext();}
rs.Close();%>
</ul></td></tr></table>
</td><td width=50% valign=top>
<table border width=100% bordercolor=456789 bordercolordark=white cellpadding=0 cellspacing=0>
<tr bgcolor=abcdef><td height=20><font color=456789>◆</font>
<b>相关文章</b></td></tr>
<tr><td><br><ul type=1><%sql="select top 7 BH,BiaoTi,RiQi,DianJi from Article where ShanChu=0 and FenLei='"+FenLei+"' order by RiQi DESC";
rs.Open(sql,conn);
C=0;
while(!rs.eof&&C<7){%>
<li><a href=<%=FileName%>?ID=<%=rs(0)%>><%=rs(1)%></a>
(<font color=green><%=rs(2)%></font>
<font color=red><%=rs(3)%></font>)</li><%C++;
rs.MoveNext();}
rs.Close();%>
</ul></td></tr></table>
</td></tr></table><%}
else{%><br><table width=770 align=center cellpadding=0 cellspacing=0>
<tr><td width=230 valign=top>
<table cellpadding=0 cellspacing=0 border bordercolor=456789 bordercolordark=white>
<tr bgcolor=abcdef><td height=20><font color=456789>◆</font>
<b>近期热门文章</b></td></tr>
<tr><td><br><ul type=1><%FenLei=Request.QueryString("分类")+"";
FenLei=FenLei.replace(/'/g,"''");
if(FenLei!="undefined"){FenLei=" and FenLei='"+FenLei+"'";}
else{FenLei="";}
sql="select top 17 BiaoTi,BH,DianJi from Article where ShanChu=0"+FenLei+" order by DianJi DESC";
rs.Open(sql,conn);
if(rs.eof) Response.Write("当前没有任何新的文章。");
C=0;
while(!rs.eof&&C<17){
Response.Write("<li>"+(""+rs(0)).link(FileName+"?ID="+rs(1))+"("+(""+rs(2)).fontcolor("red")+")</li>");
rs.MoveNext();
C++;}
rs.Close();%></ul></td></tr></table>
</td><td valign=top>
<table cellpadding=0 cellspacing=0 border bordercolor=456789 bordercolordark=white>
<tr bgcolor=abcdef><td height=20><font color=456789>◆</font>
<b><%if(Request.QueryString("分类")+""!="undefined"){%><%=Request.QueryString("分类")%><%}
else{%>全部文章<%}%></b></td></tr>
<tr><td><br><ul type=1><%Keyword=Request.QueryString("关键词")+"";
Keyword=Keyword.replace(/'/g,"''");
if(Keyword=="undefined"){Rule="";}
else{Rule=" and(BiaoTi like '%"+Keyword+"%' or NeiRong like '%"+Keyword+"%')";}
sql="select FenLei,BiaoTi,BH,RiQi,DianJi from Article where ShanChu=0"+FenLei+Rule+" order by RiQi DESC";
rs.Open(sql,conn,1);
rs.pagesize=27;
page=parseInt(Request.QueryString("页码"));
if(isNaN(page)||page<1) page=1;
if(page>rs.pagecount) page=rs.pagecount;
if(rs.eof){Response.Write("当前没有任何新的文章。");}
else{rs.absolutepage=page;
for(C=0;C<rs.pagesize;C++){
FenLei=Request.QueryString("分类")+"";
FenLei=FenLei.replace(/'/g,"''");
if(FenLei=="undefined"){FenLei="["+(rs(0)+"").link(FileName+"?分类="+rs(0))+"] ";}
else{FenLei="";}
Response.Write("<li>"+FenLei+(""+rs(1)).link(FileName+"?ID="+rs(2))+"("+(""+rs(3)).fontcolor("456789")+" "+(""+rs(4)).fontcolor("green")+")</li>");
rs.MoveNext();
if(rs.eof) break;}}
pagecount=parseInt(rs.pagecount);
recordcount=parseInt(rs.recordcount);
rs.Close();%></ul></td></tr>
<tr><td height=30> <%FenLei=Request.QueryString("分类")+"";
if(page>1){%>[<a href="<%=FileName%><%if(FenLei!="undefined") Response.Write("?分类="+FenLei);if(Keyword!="undefined"){if(FenLei=="undefined"){Response.Write("?");}else{Response.Write("&");}Response.Write("关键词="+Keyword);}%>">首页</a>] [<a href="<%=FileName%>?页码=<%=page-1%><%if(FenLei!="undefined") Response.Write("&分类="+FenLei);if(Keyword!="undefined") Response.Write("&关键词="+Keyword);%>">上一页</a>] <%}%><%if(page!=pagecount){%>[<a href="<%=FileName%>?页码=<%=page+1%><%if(FenLei!="undefined") Response.Write("&分类="+FenLei);if(Keyword!="undefined") Response.Write("&关键词="+Keyword);%>">下一页</a>] [<a href="<%=FileName%>?页码=<%=pagecount%><%if(FenLei!="undefined") Response.Write("&分类="+FenLei);if(Keyword!="undefined") Response.Write("&关键词="+Keyword);%>">最后</a>] <%}%>跳转到第
<select οnchange="location.replace('<%=FileName%>?页码='+value<%if(FenLei!="undefined"||Keyword!="undefined") Response.Write("+'");
if(FenLei!="undefined") Response.Write("&分类="+FenLei);
if(Keyword!="undefined") Response.Write("&关键词="+Keyword);
if(FenLei!="undefined"||Keyword!="undefined") Response.Write("'");%>)">
<%if(pagecount<1) pagecount=1;
for(C=1;C<=pagecount;C++){%><option value=<%Response.Write(C);
if(page==C) Response.Write(" selected")%>><%=C%></option>
<%}%></select>
页。(共 <font color=red><%=recordcount%></font> 条记录)</td></tr>
<tr><form action=<%=FileName%>>
<td align=right>文章搜索:
<input name=关键词 size="20">
<select name=分类>
<option value=undefined>所有分类</option>
<%sql="Select distinct FenLei from Article where ShanChu=0";
rs.Open(sql,conn);
while(!rs.eof){%><option value="<%=rs(0)%>"<%if(rs(0)+""==FenLei) Response.Write(" selected")%>><%=rs(0)%></option>
<%rs.MoveNext();}
rs.Close();%>
</select>
<input type=submit value=搜索>
</td></form></tr></table>
</td></tr></table>
<%}}%><hr width=456 size=1><center>
版权所有:<%=WangZhan.link(WangZhi)%>
程序运行时间:
<tt style="width:35;background:123456;cursor:wait;text-align:center">
<font size=2 color=abcdef face=Impact>
<%JieShu=(new Date()).getTime();
Response.Write(JieShu-KaiShi);%></tt>
</font>毫秒</center>
</body></html><%conn.Close();
delete rs;
delete conn;%> 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值