📄 func_forumlist.asp
字号:
<SCRIPT LANGUAGE="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore)
{ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</SCRIPT>
<%
dim sumcount,saveserial
dim msg
set rs = Server.CreateObject("ADODB.Recordset")
msg=""
if request("saveflag")="1" then
saveserial=1
if trim(request("srcname"))="" then
msg=saveserial & "、请输入信息来源!<br>"
saveserial=saveserial+1
end if
if trim(request("title"))="" then
msg=msg & saveserial & "、标题不能为空,请输入标题!<br>"
saveserial=saveserial+1
end if
if trim(request("content"))="" then
msg=msg & saveserial & "、内容不能为空,请输入内容!<br>"
saveserial=saveserial+1
end if
if saveserial<=1 then
sql="select * from cci_forum"
rs.open sql,connobj,3,3
rs.addnew
rs("typeid")=request("type")
rs("sharetype")=request("sharetype")
rs("srcname")=trim(request("srcname"))
rs("title")=trim(request("title"))
rs("intime")=now()
rs("feedbacksum")=0
rs("visitsum")=0
rs("lastsrc")=trim(request("srcname"))
rs("lasttime")=now()
rs("content")=request("content")
rs.update
rs.close
msg="发布成功!" & site_title & "谢谢您提供信息!"
end if
response.Write("<div align=center><font color=#FF0000>" &msg & "</font></div><br>")
end if
if request("infotext")<>"" then
if request("searchtype")="1" then
msg=" where a.typeid=b.id and b.id>1 and a.title like '%" & trim(request("infotext")) & "%'"
else
msg=" where a.typeid=b.id and b.id>1 and a.content like '%" & trim(request("infotext")) & "%'"
end if
else
msg=" where a.typeid=b.id and b.id>1"
end if
SQL = "select distinct a.id,a.srcname,b.typename,a.sharetype,a.title,a.intime,a.visitsum,a.feedbacksum,a.lastsrc,a.lasttime From cci_forum a,cci_forumtype b where a.typeid=b.id and b.id=1"
Rs.Open Sql,connObj,1,1
%>
<table width="100%" align="center" cellpadding="1" cellspacing="1" class=tableBorder1>
<tr>
<form action="forumlist.asp" method="post" name="searchForm" target="_parent">
<td width="76%" height="30" align="center" bgcolor="#FFFFFF"> <b>搜索:</b> <select name="searchtype">
<option value="1">标题</option>
<option value="2">内容</option>
</select>
<b>类型:</b> <select name="type">
<%
dim flag
flag=0
set rstype=createobject("adodb.recordset")
sql="select typename,id from cci_forumtype where id>1"
rstype.Open sql,connObj,3,1
do while not rstype.EOF
if request("type")=cstr(rstype("id")) then
response.Write "<option value=" & rstype("id") & " selected>" & rstype("typename") & "</option>"
flag=1
else
response.Write "<option value=" & rstype("id") & ">" & rstype("typename") & "</option>"
end if
rstype.movenext
loop
rstype.close
if flag=0 then
response.Write "<option value='' selected> </option>"
else
response.Write "<option value=''> </option>"
end if
%>
</select><b>关键字:</b>
<input name="infotext" type="text" size="30"> <input type="submit" name="Submit3" value="提交">
<input name=searchflag type=hidden value=1> </td>
</form>
</tr>
<tr>
<td align="center" valign="top" bgcolor="#FFFFFF"> <table width="100%" cellpadding="1" cellspacing="1" class=tableBorder1>
<tr align="center" >
<td class=TopLighNav height=25>标题</td>
<td width="85" class=TopLighNav>类型</td>
<td width="30" class=TopLighNav>发贴</td>
<td width="50" class=TopLighNav>发贴人</td>
<td width="90" class=TopLighNav>录入日期</td>
<td width="30" class=TopLighNav>访问</td>
<td width="30" class=TopLighNav>回复</td>
<td width="120" class=TopLighNav>最后回复</td>
</tr>
<% If (Not Rs.Eof) And (Not Rs.Bof) Then
Rs.pagesize=5
Ars = Rs.Getrows(5)
Rs.Absolutepage=1
For i = 0 To Ubound(Ars,2)
%>
<tr style="cursor:hand" bgcolor="#ffffff" align="center">
<td height=22><a href=foruminfo.asp?id=<%=Ars(0,i)%>> <%=Ars(4,i)%> </a></td>
<td><%=ars(2,i)%></td>
<td><%
select case ars(3,i)
case 1
response.Write("<font color=#FF0000>原创</font>")
case 2
response.Write("转载")
end select
%></td>
<td> <% = Ars(1,i) %></td>
<td> <% = formatdatetime(Ars(5,i),1) %> </td>
<td><% = Ars(6,i) %></td>
<td><% = Ars(7,i) %></td>
<td><% = Ars(8,i) %>[<% =formatdatetime(Ars(9,i),2) %>]</td>
</tr>
<% Next
end if
rs.close
SQL = "select distinct a.id,a.srcname,b.typename,a.sharetype,a.title,a.intime,a.visitsum,a.feedbacksum,a.lastsrc,a.lasttime From cci_forum a,cci_forumtype b " & msg & " order by a.lasttime desc"
Rs.Open Sql,connObj,1,1
sumcount=rs.recordcount
If (Not Rs.Eof) And (Not Rs.Bof) Then
page_size = 20
Rs.pagesize = page_size
page_count = Rs.pagecount
Page = Request.QueryString("page")
If Isnull(Page) or (Not Isnumeric(Page)) Then
aPage = 1
Else
aPage = Cint(page)
If aPage < 1 Then
aPage = 1
ElseIf aPage > Cint(page_count) Then
aPage = page_count
End If
End If
Rs.Absolutepage = aPage
Ars = Rs.Getrows(page_size)
For i = 0 To Ubound(Ars,2)
pubname=ars(4,i)
if len(pubname)>24 then
pubname=mid(pubname,1,24)&"..."
end if
%>
<tr style="cursor:hand" bgcolor="#EEEEEE" align="center">
<td class=TopLighNav1 height=22><a href=foruminfo.asp?id=<%=Ars(0,i)%>> <%=pubname%> </a></td>
<td class=TopLighNav1><%=ars(2,i)%></td>
<td class=TopLighNav1><%
select case ars(3,i)
case 1
response.Write("<font color=#FF0000>原创</font>")
case 2
response.Write("转载")
end select
%></td>
<td class=TopLighNav1> <% = Ars(1,i) %></td>
<td class=TopLighNav1> <% = formatdatetime(Ars(5,i),1) %> </td>
<td class=TopLighNav1><% = Ars(6,i) %></td>
<td class=TopLighNav1><% = Ars(7,i) %></td>
<td class=TopLighNav1><% = Ars(8,i) %>[<% =formatdatetime(Ars(9,i),2) %>]</td>
</tr>
<%
Next
Else
Response.Write("<tr><td bgcolor=#FFFFFF align=center colspan=8>没有查到纪录,请稍后再来或换一种查询方式!</td></tr>")
End If
%>
</table></td>
</tr>
<tr bgcolor="#ffffff">
<form name="form1">
<td height="24" align="right" > <%
msg="infotext=" & request("infotext") & "&searchtype=" & request("searchtype") '&"&type="& request("type")
If sumcount > 0 Then
%>
[共有
<% = sumcount %>
条记录 页:
<% = aPage %>
/
<% = page_count %>
]
<%
if Cint(aPage) > 1 then
%>
[<a href="forumlist.asp?page=<% = aPage - 1 %>&<%=msg%>">上一页</a>]
<%
else
response.write "[上一页]"
end if
if (Cint(aPage) < Cint(page_count)) then
%>
[<a href="forumlist.asp?page=<% = aPage + 1 %>&<%=msg%>">下一页</a>]
<%
else
response.write "[下一页]"
end if
%>
跳到
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
<%
For i = 1 to page_count
If i = aPage Then
%>
<option value="forumlist.asp?page=<% = i %>&<%=msg%>" selected>
<% = i %>
</option>
<%
else
%>
<option value="forumlist.asp?page=<% = i %>&<%=msg%>">
<% = i %>
</option>
<%
End If
Next
%>
</select>
页
<%
Else
Response.Write(" ")
End If
%> </td>
</form>
</tr>
</table>
<table width="100%" align="center" cellpadding="1" cellspacing="1" class=tableborder1>
<form name="theform" method="post" action="forumlist.asp">
<tr>
<td class=TopLighNav align="center" colspan="2"><b> 讨论区录入栏</b></td>
</tr>
<tr>
<td class=tablebody1 width="150" align="right"><b>标题:</b></td>
<td class=tablebody1><input name="title" type="text" size="55">
发布人
<input name="srcname" type="text" id="srcname" value="<%
if session("name")<>"" then
response.Write(session("name"))
else
response.Write("游客")
end if
%>" size="15">
<input type="submit" name="Submit" value="发 布"></td>
</tr>
<tr>
<td class=tablebody1 align="right"><b>类型:</b></td>
<td class=tablebody1><select name="type">
<%
i=1
if session("username")="admin" then
sql="select typename,id from cci_forumtype"
else
sql="select typename,id from cci_forumtype where id>1"
end if
rstype.Open sql,connObj,3,1
do while not rstype.EOF
if i=1 then
response.Write "<option value=" & rstype("id") & " selected>" & rstype("typename") & "</option>"
i=i+1
else
response.Write "<option value=" & rstype("id") & ">" & rstype("typename") & "</option>"
end if
rstype.movenext
loop
rstype.close
set rstype=nothing
%>
</select></td>
</tr>
<tr>
<td class=tablebody1 align="right"><b>发表类型:</b></td>
<td class=tablebody1>
<select name=sharetype>
<option value=1 selected>原创</option>
<option value=2>转载</option>
</select> </td>
</tr>
<tr>
<td align="right" valign="top" class=tablebody1><b>内容:</b><br>
在这里,您可以发表您的各种想法以及论调,为了一个良好的交流环境,大家一起来行动,说出来吧! </td>
<td valign="top" class=tablebody1><textarea name="content" cols="120" rows="15"></textarea></td>
</tr><input type=hidden name=saveflag value=1>
</form>
</table>
<%
'end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -