⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_news_list.asp

📁 1.理解Winsock编程模型; 2.掌握Winsock编程的基本方法
💻 ASP
字号:
<%
 if session("uname")="" then
%>
<script language="javascript">
				if 	(confirm("您进行的是非法登录,请重新登录!"))
				  location.href="admin.asp";			
				</script>
<%
end if
%>

<!--#include file = conn.asp -->
<!--#include file = titleb.asp -->
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
<STYLE type="text/css"> <!-- a:link { text-decoration: none; font-family: AdobeSm; color: #000000 }
a:visited { text-decoration: none; color: #000000 }
A:hover {COLOR: green; FONT-FAMILY: "宋体"; TEXT-DECORATION: underline;}
body { font-size: 9pt; font-family: 宋体, Arial;color: #000000}
TD {FONT-SIZE: 9pt; FONT-FAMILY: "宋体", "Arial";color: #000000}
p {FONT-SIZE: 9pt; FONT-FAMILY: "宋体", "Arial";color: #000000}
input {FONT-SIZE: 9pt; FONT-FAMILY: "宋体", "Arial";color: #000000}
body { margin-top: 0; margin-bottom: 0; color: #000000 }
--></STYLE>
<script language="JavaScript">
<!--
function FP_jumpMenu(el,frm,sel) {//v1.0
 var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0;
 if('_new'==frm) open(href); else eval(frm+".location='"+href+"'");
}
// -->
</script>
</head>

<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<br>
<div align="center">
	<table border="1" width="600" id="table2" cellspacing="0" cellpadding="6" style="border-collapse: collapse" bordercolor="#C0C0C0">
		<tr>
			<td bgcolor="#F5F5F5">
			<p align="center">分类显示:
<select size="1" onchange="FP_jumpMenu(this,'window',false)" id="id1" name="D1" style="font-size: 9pt">
<option value>请选择栏目</option>
<option value=admin_news_list.asp?all=all>显示所有新闻信息</option>
					  <%					  
					  sql = "select * from lm where lm<>'' order by id asc"
					  Set rs = Server.CreateObject("ADODB.RecordSet")
					  rs.Open sql,conn,1,1
					  while not rs.eof
					       response.write "<optgroup label=(ID:"&rs("id")&")"&rs("lm")&">"
							sql2 = "select * from lm where lmid='"&rs("id")&"' order by id asc"
							Set rs2 = Server.CreateObject("ADODB.RecordSet")
							rs2.Open sql2,conn,1,1
							while not rs2.eof
							%>
							   <option value='admin_news_list.asp?lm=<%=rs2("id")%>' <% if int(lmid)=rs2("id") then response.write " selected" %>>├(编号:<%=rs2("id")%>)<%=rs2("lm2")%></option>
							<%
							rs2.movenext
							wend
					  rs.movenext
					  wend 
					  rs.close
					  set rs=nothing
					 
					%>

</select>

			</td>
		</tr>
<%if session("dj")=1 then%>
		<tr>
			<td>
			<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="JavaScript" Type="text/javascript"><!--
function FrontPage_Form1_Validator(theForm)
{

  if (theForm.title.value == "")
  {
    alert("请在 关键字 域中输入值。");
    theForm.title.focus();
    return (false);
  }

  if (theForm.title.value.length < 1)
  {
    alert("在 关键字 域中,请至少输入 1 个字符。");
    theForm.title.focus();
    return (false);
  }

  if (theForm.title.value.length > 10)
  {
    alert("在 关键字 域中,请最多输入 10 个字符。");
    theForm.title.focus();
    return (false);
  }
  return (true);
}
//--></script><!--webbot BOT="GeneratedScript" endspan --><form method="POST" action="admin_news_list.asp" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1">
				<center>
				<table border="0" width="586" id="table3" cellpadding="0">
					<tr>
						<td width="292">
						<p align="right">按标题模糊搜索所有新闻</td>
						<td width="292">
						&nbsp;<!--webbot bot="Validation" s-display-name="关键字" b-value-required="TRUE" i-minimum-length="1" i-maximum-length="10" --><input type="text" name="title" size="20" maxlength="10" style="border-style: solid; border-width: 1px"><input type="submit" value="搜索" name="B1" style="border: 1px solid #000000; background-color: #FFFFFF"></td>
					</tr>
				</table>
				</center>
			</td>
		
<%end if%>


<%
lm=trim(request("lm"))
if lm<>"" then
  sql = "select * from lm where id="&lm
  Set rs = Server.CreateObject("ADODB.RecordSet")
  rs.Open sql,conn,1,1
%>
		<tr>
			<td align=center><font color=ff0000><B>查看“<%=rs("lm2")%>”的新闻文章</b></font></td>
		</tr>
<%end if%>
	</table>
</div>
<div align="center">
	 
  <table border="1" width="750" id="table1" cellspacing="0" cellpadding="3" style="border-collapse: collapse" bordercolor="#C0C0C0">
    <tr> 
      <td width="236" align="center" bgcolor="#F5F5F5" background="images/topBar_bg.gif"><b>(编号)标题(阅读)</b></td>
      <td width="89" align="center" bgcolor="#F5F5F5" background="images/topBar_bg.gif"><b>栏目</b></td>
      <td width="115" align="center" bgcolor="#F5F5F5" background="images/topBar_bg.gif"><b>加入时间</b></td>
      <td width="168" align="center" bgcolor="#F5F5F5" background="images/topBar_bg.gif"><b>操作</b></td>
    </tr>
    <%
lm=trim(request("lm"))
title=trim(request("title"))


  sql = "select * from news where title<>'' "
  
	  if lm<>"" then 
	    sql = sql & " and (lm2='"&lm&"' or lm='"&lm&"') "
	  end if 
	  if title<>"" and lm="" then
	    sql = sql & " and title like '%"&title&"%' "
	  end if  	 

   sql= sql& " order by newsid desc"

  Set rs = Server.CreateObject("ADODB.RecordSet")
  rs.Open sql,conn,1,1
  if rs.recordcount<>0 then

	page=int(request.QueryString ("page"))
	rs.PageSize=20
	pagecount=rs.pagesize
	if page<=0 then page=1
	if request.QueryString("page")="" then page=1
	rs.AbsolutePage=page
	gg=rs.recordcount/pagecount
	gh=int(gg)
	if gh<=1 then gh=1
	if gg>gh then gh=gh+1
	gg=gh
	
	for i=1 to pagecount
	
			   lm2=trim(rs("lm2"))
			   if lm2="" then lm2=0
			   sql2 = "select * from lm where id="&clng(lm2)
			   Set rs2 = Server.CreateObject("ADODB.RecordSet")
			   rs2.Open sql2,conn,1,1
			   fontcolor=rs2("fontcolor")
			   
			   if rs("titlecolor")="默认颜色" then
			     fontcolor=rs2("fontcolor")
			   else
			     fontcolor=rs("titlecolor")
			   end if
%>
    <tr> 
      <td width="236">(<%=rs("newsid")%>)<a href="news_view.asp?newsid=<%=rs("newsid")%>" target=_blank title='<%=rs("title")%>'><font color=<%=trim(fontcolor)%>><%=titleb(rs("title"),20)%></font></a> 
        <%if trim(rs("tupian"))=true then Response.Write "[图]"%></font>
        </td>
      <td width="89" align=center> 
        <%

			   if rs2.recordcount<>0 then 
			      response.write rs2("lm2")
			   else
			      response.write "<font color=blue>栏目不正确</font>" 
			   end if
			   %>
      </td>
      <td width="115" align="center"><%=rs("pubdate")%></td>
      <td width="168"> 
        <%


			   %>
        <a href="news.asp?action=修改&id=<%=Cstr(rs("NewsId"))%>">修改</a> 
        <a onclick='{if(confirm("您确定删除吗?此操作将不能恢复!")){return true;}return false;}' href=news.asp?action=删除&id=<%=rs("newsid")%>>删除</a> 
      </td>
    </tr>
    <%

rs.movenext
if rs.eof then exit for
next
else
  Response.Write "<tr><td colspan=4>暂无信息</td></tr>"
   end if
%>
  </table>
</div>
<center><br>
<%
if rs.recordcount<>0 then
  if page>1 then%>
     <a href='<%=request.servervariables("URL")%>?page=1&title=<%=title%>&lm=<%=lm%>'>首页</a>
     <a href='<%=request.servervariables("URL")%>?page=<%=page-1%>&title=<%=title%>&lm=<%=lm%>'>上一页</a>
  <%end if%>
  <%if page<gg then%>
     <a href='<%=request.servervariables("URL")%>?page=<%=page+1%>&title=<%=title%>&lm=<%=lm%>'>下一页</a>
     <a href='<%=request.servervariables("URL")%>?page=<%=rs.pagecount%>&title=<%=title%>&lm=<%=lm%>'>尾页</a>
  <%end if%>
 共<%=rs.recordcount%>条 每页显示<%=pagecount%>条  第<%=page%>页 共<%=rs.pagecount%>页				
    <script language="JavaScript">
      <!--
       function FP_jumpMenu(el,frm,sel) {//v1.0
       var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0;
       if('_new'==frm) open(href); else eval(frm+".location='"+href+"'");
        }
       // -->
     </script>

   <select size="1" onchange="FP_jumpMenu(this,'window',false)" id="id1" name="D1" style="font-size: 9pt; border-style: solid; border-width: 1px">
        <%for i=1 to rs.pagecount%>
          <option value="<%=request.servervariables("URL")%>?page=<%=i%>&title=<%=title%>&lm=<%=lm%>" <%if page=i then response.write "selected"%>>第<%=i%>页</option>
        <%next%>
    </select>
</p>
<%end if%>
</center>
</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -