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

📄 news.asp

📁 一个漂亮的网络工作室源码 后台地址:/admin 用户名:admin 密码:admin888
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<%
If Cint(AdminGroup(1))<>1 then
Response.Redirect("Default.asp")
Response.End()
End If
%>
<!--#include file="top.asp"-->
<!--#include file="../inc/ubbcode.asp"-->
<%
select case request("action")
case "edit"
call edit()
case else
call normal()
end select
sub normal()
dim listid,strFileName
listid=request.QueryString("listid")
dim rslt,lt
set rslt=conn.execute("select title from list where id="&clng(listid))
if rslt.bof and rslt.eof then
response.Write("<script>alert('该栏目不存在或者已被删除!');history.back()</script>")
response.End()
end if
lt=rslt(0)
rslt.close
set rslt=nothing

strFileName="news.asp?listid=" & listid
pageno=15
%>
<table border="0" align="center" cellpadding="3" cellspacing="1" class="tablecolor">
  <tr> 
    <td height="25" align="center" class="banner"><%=htmlcode(lt)%></td>
    <td width="20%" align="center" class="banner"><a href="addnews.asp?listid=<%=listid%>">添加数据</a></td>
  </tr>
</table>
<%
dim rs
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from news where listid="&clng(listid)&" order by addtime desc",conn,1,1
rscount=rs.recordcount
%>
<table border="0" align="center" cellpadding="3" cellspacing="1" class="tablecolor">
  <%
   if  rscount<1 then
  %>
  <tr> 
    <td height="25" colspan="5" align="center" class="tablebody">该栏目还没有数据</td>
  </tr>
<%
else
call showsql(pageno)
 %>
 <tr> 
    <td align="center" class="tablebody">标题</td>
    <td width="25%" align="center" class="tablebody">加入时间</td>
    <td width="20%" align="center" class="tablebody">状态</td>
	<td width="10%" align="center" class="tablebody">修改</td>
    <td width="10%" align="center" class="tablebody">删除</td>
  </tr><form name="form2" method="post" action="?action=edit" onSubmit="return checkf(form2)">
  <%
rs.move(rsno)
for i=1 to loopno
  %>
   <tr> 
    <td align="center" class="tablebody"><font color="<%=rs("titlecolor")%>"><%=rs("title")%></font></td>
    <td align="center" class="tablebody"><%=rs("addtime")%></td>
    <td align="center" class="tablebody"> 
      <%if rs("istop")=1 then response.Write("置顶") else response.Write("普通") end if%>
      / 
      <%if rs("isview")=1 then response.Write("显示") else response.Write("隐藏") end if%></td>
	<td align="center" class="tablebody"><a href="addnews.asp?id=<%=rs("id")%>&listid=<%=rs("listid")%>">修改</a></td>
    <td align="center" class="tablebody"><input name="id" type="checkbox" id="id" value="<%=rs("id")%>">
   </tr><%
  rs.movenext
  next
  %>
  <tr>
    <td height="25" colspan="5" align="right"  class="tablebody"><INPUT onclick=CheckAll(this.form) type=checkbox value=on name=chkall>
      &nbsp;全选
        
        <input type="submit" name="Submit" value="主题置顶">
        <input name="Submit" type="submit" id="Submit" value="取消置顶">
        <input name="Submit" type="submit" id="Submit" value="隐藏">
        <input name="Submit" type="submit" id="Submit" value="显示">
        <input name="Submit" type="submit" id="Submit" value="删除" onclick="SetSubmitImgId('realdel');">
        &nbsp;</td>
  </tr>
  </form>
  <tr> 
      <td colspan="5" align="right"  class="tablebody"><%call showpage(strFileName,rscount,pageno,false,true,"条新闻")%></td>
  </tr>
  <% end if%>
</table>
<%
end sub
sub edit()
dim id,sql
if request("id")="" then
response.Write("<script>alert('参数错误!');history.back()</script>")
response.End()
end if
select case request("submit")
case "主题置顶"
sql="update news set istop=1 where id="
case "取消置顶"
sql="update news set istop=0 where id="
case "显示"
sql="update news set isview=1 where id="
case "隐藏"
sql="update news set isview=0 where id="
case "删除"
sql="delete from news where id="
case else
response.Write("<script>alert('参数错误!');history.back()</script>")
response.End()
end select
for each id in request("id")
conn.execute(sql&id)
next
dim ip
ip=Request.ServerVariables("HTTP_REFERER")
response.Write("<script>alert('操作成功!');location='"&ip&"'</script>")
response.End()
end sub
%>
<%CloseConn%>
<!--#include file="end.asp"-->

⌨️ 快捷键说明

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