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

📄 editnote.asp

📁 一个网络相册
💻 ASP
字号:
<% option explicit %>
<!--#include file="../function1/DBOpen.asp"-->
<%
if session("purview")="" then
     Response.Redirect"../login.asp?id=0"
end if
  dim isedit  '是否在修改状态
  dim color  '表格颜色
  dim sql,rs,rsc,sql2,rs2,classid,ownername
  ownername=session("name")
  color=1
  isedit=false
    function invert(str) 
    invert=replace(replace(replace(replace(str,"&lt;","<"),"&gt;",">"),"<br>",chr(13)),"&nbsp;"," ")
    end function
  if request("action")="edit" then
      isedit=true
  end if
  if request("action")="modify" then   '**************************修改*********************
    if trim(request("content"))="" or trim(request("topic"))="" then
	    response.write "错误!标题或内容不能为空! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
        response.end
    end if
	sql="update travel_notes set content='" & cstr(request("content")) & "' ,topic='" & cstr(trim(request("topic"))) & "',author='" & cstr(trim(request("author"))) & "',classid='" & cstr(trim(request("classid"))) & "' where noteid=" & cstr(request("noteid"))
	conn.execute sql
	if err.number <> 0 then
	    response.write "数据库操作出错:" + err.description
	else  
	response.redirect "editok.htm"
	end if
  end if
  if request("action")="add" then   '******************************添加新文章************************
       if trim(request("topic"))="" or trim(request("content"))="" then
	    response.write "错误!文章标题或内容不能为空! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
        response.end
        end if
	set rs=server.createobject("ADODB.recordset") 
         rs.Open "SELECT * from travel_notes",conn,1,3 
		 rs.addnew
		 rs("content")=request("content")
		 rs("topic")=request("topic")
		 rs("time")=now()
		 rs("author")=request("author")
		 rs("classid")=request("classid")
		 rs.update
		 rs.close
		 set rs=nothing
	if err.number <> 0 then
	    response.write "数据库操作出错:" + err.description
     end if
	 response.redirect "editok.htm"
  end if
  if request("action")="del" then   '**********************删除文章**********************
		sql="delete from travel_notes where   noteid=" & cstr(request("noteid")) 
	conn.execute sql
	if err.number <> 0 then
		response.write "数据库操作错误:" + err.description
		err.clear
	else 
		%>
<script language=vbscript>
		msgbox "操作成功!该文章已删除!"
		</script>
<%  end if
end if
%><html>
<head> 
<title>文章编辑</title>
<meta http-equiv="Content-board" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.style4 {
	font-size: 18px;
	font-weight: bold;
}
-->
</style>
<div align="center"> 
  <STYLE>TABLE {FONT-SIZE: 12px;COLOR: #000000; FONT-FAMILY: 宋体;LINE-HEIGHT: 180%}
.Shadow_white {FONT-SIZE: 14pt; FILTER: dropshadow(color:black, offx=1, offy=1, positive=1); WIDTH: 70%; COLOR: #000000; FONT-FAMILY: 宋体; POSITION: relative}
.Shadow_white2 {FONT-SIZE: 10pt; FILTER: dropshadow(color:black, offx=1, offy=1, positive=1); WIDTH: 70%; COLOR: #000000; FONT-FAMILY: 宋体; POSITION: relative}
A:link {COLOR: #000000; TEXT-DECORATION: none}
A:active {COLOR: #000000; TEXT-DECORATION: none}
A:visited {COLOR: #000000; TEXT-DECORATION: none}
A:hover {COLOR: #ff0000; TEXT-DECORATION: underline}
</STYLE></head>
  <body> 
  <script language=JavaScript>
function SureDel(id)
{ 
    if ( confirm("确定删除这个文章吗?"))
        {
          window.location.href = "note.asp?action=del&noteid=" + id
        }		
}
</script>
  <br>
  <table width="80%" border="0" cellspacing="0" cellpadding="0" bgcolor="#99CCCC" style="border: 1px solid #000000">
    <tr> 
      <td height="100"> 
        <form action="editnote.asp" method="post">
          <table width="99%" border="0" cellspacing="0" cellpadding="0" align="center">
            <tr>
              <td height="30"> 
                <div align="center"> 
                  <% if isedit then
	       set rs=server.createobject("adodb.recordset")
		   rs.open "select * from travel_notes where noteid=" & cstr(request("noteid")),conn,1,1
	       response.write "<b>编 辑 文 章</b><br>"
	   else
	       response.write "<b>添 加 新 文 章</b><br>"
	   end if %>
                </div>
              </td>
            </tr>
            <tr>
              <td height="34" valign="top"><input type="Hidden" name="action" value='<% If isedit then%>modify<% Else  %>add<% End If %>'>
                <%If isedit then%>
                <input type="Hidden" name="noteid" value='<%=cstr(request("noteid"))%>'>
                <%End If%>
文章标题:
<input type="text" name="topic" class=input maxlength=50 size="84" value='<% if isedit then
		                                                         response.write trim(rs("topic")) 
															 end if %>'></td>
            </tr>
            <tr>
              <td height="33" valign="top">作&nbsp;&nbsp;&nbsp;&nbsp;者:
                <input name="author" type="text" class=input id="author" value='<% if isedit then
		                                                         response.write trim(rs("author")) %>
															 <%end if %>' size="20" maxlength=50>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;关联相册:
                
<select name="classid" id="classid">
  <option value="0">无关联相册</option>
  <%
				    if session("purview")="99999" then
					sql2="SELECT * FROM class "
					else
					sql2="select * from class where owner='" & trim(ownername) & "'"
					end if
                 Set rs2 = Server.CreateObject("ADODB.Recordset")
                     rs2.OPEN sql2,Conn,1,1
                     if rs2.eof and rs2.bof then
                         Response.Write"<option>没有相册</option>"
                        else
                        do while not rs2.eof
                         Response.Write"<option value='"&rs2("id")&"'"
                           if isedit then
                               classid=trim(rs("classid"))
                            if classid=trim(rs2("id")) then Response.Write" selected" 
                            end if
                         Response.Write">"&rs2("name")&"</option>"
                         rs2.movenext
                         loop
                     end if
                    %>
</select></td>
            </tr>
            <tr>
              <td valign="top"> 
                <div align="center">
                  <input name="time" type="hidden" id="time" value=now()>

       <textarea name="content" style="display:none"><% If isedit then response.write rs("content") end if %></textarea>
       <iframe ID="eWebEditor1" src="../eWebEditor/ewebeditor.asp?id=content&style=s_coolblue" frameborder="0" scrolling="no" width="100%" HEIGHT="400"></iframe> 
	  &nbsp;<br>
	<INPUT type=submit name=b1 value="提交"> 
	&nbsp;
	<INPUT type=reset name=b2 value="重填"> 
                </div>
              </td>
            </tr>
          </table>
        </form>
      </td>
    </tr>
  </table>
</div>
<p align="center">&nbsp; </p>
</body>
</html>
<!--#include file="../function/DBclose.asp"-->

⌨️ 快捷键说明

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