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

📄 admin_diary.asp

📁 后台登陆admin.asp
💻 ASP
字号:
<!--#include file="mdb.asp"-->
<%Admin="diary"%>
<!--#include file="check.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="inc/format.asp"-->
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="inc/admin.css" type=text/css rel=StyleSheet>
<META content="MSHTML 6.00.2800.1126" name=GENERATOR>
<TITLE>管理系统——公告管理</TITLE>
</HEAD>
<body onkeydown=return(!(event.keyCode==78&&event.ctrlKey)) >
<%

'****************************************************
if session("adminlogin")<>sessionvar then
  Response.Write("<script language=javascript>alert('你尚未登录,或者超时了!请重新登录');this.top.location.href='admin.asp';</script>")
  response.end
end if
if Request.form("MM_insert") then
if request.form("action")="newdiary" then
dim d_content,d_class
d_content=rtrim(replace(request.form("textfield"),"'","''"))
d_content=trim(replace(d_content," ","&nbsp;"))
d_class=int(request.form("d_class"))
if d_content="" then
  Response.Write("<script language=javascript>alert('你必须输入公告内容!');history.back(1);</script>")
  response.end
end if
  conn.Execute ("Insert Into diary(d_content,d_class) Values('"&d_content&"',"&d_class&")")
  response.redirect "admin_diary.asp"
end if
'================www.ynsky.com.cn===============
if request.form("action")="editdiary" then
 if request.form("id")="" then
   Response.Write("<script language=javascript>alert('你必须指定操作的对象!');history.back(1);</script>")
   response.End
 else
  if not isInteger(request.form("id")) then
    Response.Write("<script language=javascript>alert('非法的id参数。');history.back(1);</script>")
    response.End
  end if
end if
d_content=rtrim(replace(request.form("textfield"),"'","''"))
d_content=trim(replace(d_content," ","&nbsp;"))
d_class=int(request.form("d_class"))
if d_content="" then
  Response.Write("<script language=javascript>alert('你必须输入公告内容!');history.back(1);</script>")
  response.End
end if
    conn.execute ("UPDATE [diary] SET d_class="&clng(d_class)&",d_content='"&d_content&"' where d_id="&clng(request.form("id"))&"")
    response.redirect "admin_diary.asp"
end if
end if
'================www.ynsky.com.cn===============
if request.querystring("action")="" then
%>
<SCRIPT LANGUAGE=javascript>
    //实现反向选择
    <!--
    function SelectAll() {
	for (var i=0;i<document.selform.selID.length;i++) {
		var e=document.selform.selID[i];
		e.checked=!e.checked;
	}
    }
    //-->
</script>
<%dim selID
if not isempty(request("selID")) then
   selID=request("selID")
   if request("hx66")="删除" then
      Conn.execute("delete from diary where d_id in ("&selID&")")
   elseif request("hx66")="取消显示" then
      Conn.execute("update diary set d_top=1 where d_id in ("&selID&")")
   elseif request("hx66")="设为显示" then
      Conn.execute("update diary set d_top=0 where d_id in ("&selID&")")
   else
      response.write "无效参数!"
      response.end
   end if	
      response.Write"<script language=javascript>alert(' 恭喜您 ! 操作成功 !');this.location.href='admin_diary.asp';</script>"		
end if
Dim CurPage,Url_Add
Url_Add="?"
If Request.QueryString("Page")<>"" Then
   Curpage=Request.QueryString("Page")
   If IsInteger(Curpage)=False OR Curpage<0 Then Curpage=1
Else
   Curpage=1
End If
sql="select * from diary order by d_id DESC"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table align="center" width="98%" align="center" border="1" cellspacing="0" cellpadding="4" class=Hxcmsbk style="border-collapse: collapse">
        <tr class=Hxcmsss> 
          <td colspan="6">公告管理</td>
        </tr>
        <tr class=Hxcmsqs align="center"> 
          <td width="30">选择</td>
          <td width="30">显示</td>
          <td width="50">位置</td>
          <td width="*">内容</td>
          <td width="150">时间</td>
          <td width="60">操作</td>
        </tr>
<%
if rs.eof and rs.bof then
  Response.Write("<tr align=""center""><td class=Hxcmsds colspan=6>当前没有公告!</td></tr>")
Else
   Dim web_Nums,MultiPages,j
   rs.PageSize=adflperpage
   rs.AbsolutePage=CurPage
   web_Nums=rs.RecordCount
   MultiPages="<tr><td class=Hxcmsqs colspan=""6"" align=""center"">共有公告:"&web_Nums&"条。&nbsp;&nbsp;"&MultiPage(web_Nums,adflperpage,CurPage,Url_Add)&"</td></tr>"
Do Until Rs.EOF OR j=adflperpage
%>
<form name="selform" method="post" hx66="">
        <tr class=Hxcmsds> 
          <td align="center"><input type="checkbox" name="selID" id="selID" value="<%=rs("d_id")%>"></td>
          <td align="center">
<%if rs("d_top")=1 then%> 
×
<%end if%>
<%if rs("d_top")=0 then%> 
<font color=red>√</font>
<%end if%></td>
          <td align="center">
<%if rs("d_class")=0 then
  Response.Write"全站公告"
elseif rs("d_class")=1 then
  Response.Write"首页公告"
elseif rs("d_class")=2 then
  Response.Write"新闻文章"
elseif rs("d_class")=3 then
  Response.Write"音乐影视"
elseif rs("d_class")=4 then
  Response.Write"图片资源"
elseif rs("d_class")=5 then
  Response.Write"留言公告"
elseif rs("d_class")=6 then
  Response.Write"商城供求"
end if%></td>
          <td><%=cutstr(formatstr(rs("d_content")),40,false,none)%></td>
          <td align="center"><%=rs("d_date")%></td>
          <td align="center"><a href="admin_diary.asp?id=<%=rs("d_id")%>&action=editdiary">编辑</a></td>
        </tr>
<%
j=j+1
rs.movenext
loop
end if
rs.close
set rs=nothing
%>
    <tr class=Hxcmsds> 
      <td colspan="6" height="30">批量操作:本页全选 
        <input type="checkbox" name="checkbox" value="checkbox" onClick="javascript:SelectAll()">  
        <input onClick="{if(confirm('确定删除选定的公告吗?')){this.document.selform.submit();return true;}return false;}" type=submit value=删除 name=hx66 class="button"> 
        <input onClick="{if(confirm('确定取消显示选定的公告吗?')){this.document.selform.submit();return true;}return false;}" type=submit value=取消显示 name=hx66 class="button"> 
        <input onClick="{if(confirm('确定设为显示选定的公告吗?')){this.document.selform.submit();return true;}return false;}" type=submit value=设为显示 name=hx66 class="button"> 注:显示:√为是,×为否。
      </td>
    </tr>
  </form>
<%
Response.Write(MultiPages)
Response.Write("</table>")
end if
'================www.ynsky.com.cn===============
if request.querystring("action")="newdiary" then%>
<table align="center" width="98%" align="center" border="1" cellspacing="0" cellpadding="4" class=Hxcmsbk style="border-collapse: collapse">
        <form name="form1" method="post" action="">
          <tr class=Hxcmsss> 
            <td>新的公告</td>
          </tr>
          <tr class=Hxcmsds> 
            <td> <input type="text" name="textfield" size="80" class="textarea">
            </td>
          </tr>
          <tr class=Hxcmsqs> 
            <td align="center" height="30">
<select name="d_class" id="d_class">
<option value="0" selected>&nbsp;全站公告&nbsp;</option>
<option value="1">&nbsp;首页公告&nbsp;</option>
<option value="2">&nbsp;新闻文章&nbsp;</option>
<option value="3">&nbsp;音乐影视&nbsp;</option>
<option value="4">&nbsp;图片资源&nbsp;</option>
<option value="5">&nbsp;留言公告&nbsp;</option>
<option value="6">&nbsp;商城供求&nbsp;</option>
</select>&nbsp;&nbsp;&nbsp;&nbsp;
              <input type="submit" name="Submit" value="确定新增" class="button">
              <input type="reset" name="Reset" value="清空重写" class="button">
            </td>
          </tr>
          <input type="hidden" name="action" value="newdiary">
          <input type="hidden" name="MM_insert" value="true">
        </form>
      </table>
<%end if
'================www.ynsky.com.cn===============
if request.querystring("action")="editdiary" then
if request.querystring("id")="" then
  Response.Write("<script language=javascript>alert('请指定操作的对象!');history.back(1);</script>")
  response.end
else
  if not isinteger(request.querystring("id")) then
    Response.Write("<script language=javascript>alert('非法的ID参数!');history.back(1);</script>")
	response.end
  end if
end if
sql="select * from diary where d_id="&cint(request.querystring("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table align="center" width="98%" align="center" border="1" cellspacing="0" cellpadding="4" class=Hxcmsbk style="border-collapse: collapse">
        <form name="form1" method="post" action="">
          <tr class=Hxcmsss> 
            <td>修改公告</td>
          </tr>
          <tr class=Hxcmsds> 
            <td><input type="text" name="textfield" size="80" class="textarea" value="<%=rs("d_content")%>"></td>
          </tr>
          <tr class=Hxcmsqs> 
            <td align="center" height="30">
<select name="d_class" id="d_class">
<option value="0" <%if rs("d_class")="0" then response.write "selected" end if%>>&nbsp;全站公告&nbsp;</option>
<option value="1" <%if rs("d_class")="1" then response.write "selected" end if%>>&nbsp;首页公告&nbsp;</option>
<option value="2" <%if rs("d_class")="2" then response.write "selected" end if%>>&nbsp;新闻文章&nbsp;</option>
<option value="3" <%if rs("d_class")="3" then response.write "selected" end if%>>&nbsp;音乐影视&nbsp;</option>
<option value="4" <%if rs("d_class")="4" then response.write "selected" end if%>>&nbsp;图片资源&nbsp;</option>
<option value="5" <%if rs("d_class")="5" then response.write "selected" end if%>>&nbsp;留言公告&nbsp;</option>
<option value="6" <%if rs("d_class")="6" then response.write "selected" end if%>>&nbsp;商城供求&nbsp;</option>
</select>&nbsp;&nbsp;&nbsp;&nbsp;
              <input type="submit" name="Submit" value="确定修改" class="button">
              <input type="reset" name="Reset" value="清空重写" class="button">
            </td>
          </tr>
          <input type="hidden" name="id" value="<%=rs("d_id")%>">
          <input type="hidden" name="action" value="editdiary">
          <input type="hidden" name="MM_insert" value="true">
        </form>
      </table>
<%
rs.close
set rs=nothing
end if

'****************************************************
%>

⌨️ 快捷键说明

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