用ASP技术实现网上作文的自动化管理 第3页
end if
next
response.write("</td></tr>")
response.write("<tr><td width='100%'>")
response.write("<table border='0' width='100%' style='font:9pt' cellpadding='2'>")
rec.AbsolutePage=ymh
j=0
<tr>
<td width="39%" align="center" bgcolor='#FF9900'>题目</td>
<td width="11%" align="center" bgcolor='#FF9900'>作者</td>
<td width="14%" align="center" bgcolor='#FF9900'>上传时间</td>
<td width="7%" align="center" bgcolor='#FF9900'>年级</td>
<td width="9%" align="center" bgcolor='#FF9900'>类别</td>
<td width="9%" align="center" bgcolor='#FF9900'>点击数</td>
<td width="11%" align="center" bgcolor='#FF9900'>评论条数</td>
</tr>
<%
do while not rec.EOF and j<rec.PageSize
j=j+1
Response.Write("<tr>")
Response.Write("<td width='39%' align='center'><a href='clicktoread.asp?id=" & _
rec.fields("id").value & "&pid=" & rec.fields("pid").value & _
"' target='_blank'>" & rec.fields("题目").value & "</a></td>")
Response.Write("<td width='11%' align='center'>" & rec.fields("发表者").value & "</td>")
Response.Write("<td width='14%' align='center'>" & ShowDatePart(rec.fields("发表时间").value) & "</td>")
Response.Write("<td width='7%' align='center'>" & rec.fields("年级").value & "</td>")
Response.Write("<td width='9%' align='center'>" & rec.fields("类别").value & "</td>")
Response.Write("<td width='9%' align='center'>" & rec.fields("点击次数").value & "</td>")
Response.Write("<td width='11%' align='center'>" & rec.fields("评论条数").value & "</td>")
Response.Write("</tr>")
rec.MoveNext
loop
Response.Write("</table>")
response.write("</td></tr></table>")
rec.Close
set rec=nothing
con.Close
set con=nothing
%>
<tr>
<td width="100%"></td>
</tr>
</table>
</body>
2.查询作文。浏览者在表单中填入查询标准,并在右方的选框中确认后,可点击确定进行作文查询。查询的执行由search.ASP文件来执行。其代码及分析如下:
<%@ Language=VBScript %>
<!-- #include file="AboutFunctions.inc" -->
<style type="text/css" rel=stylesheet>
A:link {color:blue;text-decoration:none;}
A:hover {color:red;text-decoration:none;}
A:visited}
</style>
<%
on error resume next
dim bt,zz,lj,lx,add_result,sql
if request.form("pd")="true" then
'从首页传过来的
add_result=cint(request.form("kk1"))+cint(request.form("kk2"))+cint(request.form("kk3"))+cint(request.form("kk4"))
if add_result=0 then
Response.Write("<font style='font:9pt'>对不起,请至少选择一个查询项目!</font>")
Response.End
end if
bt=trim(request.form("bt"))'标题
zz=trim(request.form("zz"))'作者(别名)
lj=request.form("lj")'年级
lx=request.form("type")'类型
else
add_result=request.querystring("add_result")
bt=request.querystring("bt")
zz=request.querystring("zz")
lj=request.querystring("lj")
lx=request.querystring("lx")
end if
'*************************对输入的语句进行处理**************
if instr(bt,"'") then
Response.Write("<font style='font:9pt'>对不起,非法查询字符[']!</font>")
Response.End
end if
if instr(bt,"&") then
Response.Write("<font style='font:9pt'>对不起,非法查询字符[&]!</font>")
Response.End
end if
if instr(zz,"'") then
Response.Write("<font style='font:9pt'>对不起,非法查询字符[']!</font>")
Response.End
end if
if instr(zz,"&") then
Response.Write("<font style='font:9pt'>对不起,非法查询字符[&]!</font>")
Response.End
end if
'***********************************************************
set con=server.CreateObject("ADODB.Connection")
set rec=server.CreateObject("ADODB.recordset")
con.Open "user","user","user"
select case add_result
case 1
if bt="" then
Response.Write("<font style='font:9pt'>对不起,请输入你要查找的标题关键字!</font>")
Response.End
end if
sql="select * from zwtd_info where 题目 like '%" & bt & "%' order by 发表时间 desc"
case 2
if zz="" then
Response.Write("<font style='font:9pt'>对不起,请输入你要查找的作者关键字!</font>")
Response.End
end if
sql="select * from zwtd_info where 发表者 like '%" & zz & "%' order by 发表时间 desc"
case 3
sql="select * from zwtd_info where 发表者 like '%" & zz & _
"%' and 题目 like '%" & bt & "%' order by 发表时间 desc"
case 4
sql="select * from zwtd_info where 年级='" & lj & "' order by 发表时间 desc"
case 5
if bt="" then
Response.Write("<font style='font:9pt'>对不起,请输入你要查找的标题关键字!</font>")
Response.End
end if
sql="select * from zwtd_info where 题目 like '%" & bt & "%' and 年级='" & lj & "' order by 发表时间 desc"
case 6
if zz="" then
上一页 [1] [2] [3] [4] [5] [6] 下一页
用ASP技术实现网上作文的自动化管理 第3页下载如图片无法显示或论文不完整,请联系qq752018766