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

📄 admin_newssave.asp

📁 ASP源程序采用天空软件小偷中心核件制成
💻 ASP
字号:
<!--#include file="function.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="admin_loginchk.asp"-->
<%admin2%>
<!--#include file="top.asp"-->
<!--#include file="code.asp"-->
<!--#include file="inc/char.asp"-->
<%
	dim rs,sql
	dim title
	dim content
	dim articleid
	dim classid,Nclassid
	dim Nkey
	dim writer
	dim writefrom
	dim errmsg
	dim founderr
	founerr=false
		
	
	if trim(request.form("txttitle"))="" then
  		founderr=true
  		errmsg="<li>文章名不能为空</li>"
	end if
	if trim(request.form("txtcontent"))="" then
  		founderr=true
  		errmsg=errmsg+"<li>文章内容不能为空</li>"
	end if
	if trim(request.form("key"))="" then
	    key="-"
		else
        key=trim(request.form("key"))
  		end if
		
	if trim(request.form("special"))="" then
	    special="-1"
		else
        special=trim(request.form("special"))
  		end if
		
	if trim(request.form("classid"))="" then
  		founderr=true
  		errmsg=errmsg+"<li>文章分类不能为空</li>"
	end if
	if trim(request.form("Nclassid"))="" then
  		founderr=true
  		errmsg=errmsg+"<li>文章专题不能为空</li>"
	end if
	if trim(request.form("tuaddress"))="" then
	    tuaddress="-"
		else 
		tuaddress=trim(request.form("tuaddress"))
  		end if
	
	if trim(request.form("width"))="" then
	    width="0"
		else 
		width=trim(request.form("width"))
  		end if
	if trim(request.form("high"))="" then
  		high="0"
		else 
		high=trim(request.form("high"))
	end if

	if founderr=false then
		title=htmlencode(request.form("txttitle"))
		Nkey=htmlencode(key)
		classid=request.form("classid")
		Nclassid=request.form("Nclassid")
		tuwen=request.form("tuwen")
		
		if request("htmlable")="yes" then
		content=htmlencode2(request("txtcontent"))
		else
		content=ubbcode(request.form("txtcontent"))
		end if

	set rs=server.createobject("adodb.recordset")
	     	
	if request("action")="add" then
		call addnews()
	elseif request("action")="edit" then
		call editnews()
   	else
		founderr=true
		errmsg=errmsg+"<li>没有选定参数</li>"
	end if
	
sub addnews()
	sql="select * from article where (articleid is null)" 
	rs.open sql,conn,1,3
	rs.addnew
	rs("title")=title
	rs("content")=content
	rs("Nclassid")=Nclassid
	rs("classid")=classid
	rs("sid")=special
	rs("Nkey")=Nkey
	rs("tuwen")=tuwen
	rs("width")=width
	rs("high")=high
	rs("tuaddress")=tuaddress
	rs("hits")=0
	if request.form("writer")<>"" then
		rs("writer")=trim(request.form("writer"))
	end if
	if request.form("writefrom")<>"" then
		rs("writefrom")=trim(request.form("writefrom"))
	end if
	rs("dateandtime")=date()
	rs.update
	articleid=rs("articleid")
	%>
<%
	
end sub

sub editnews()
	sql="select * from article where articleid="&request("id")
	rs.open sql,conn,1,3
	rs("title")=title
	rs("content")=content
	rs("Nclassid")=Nclassid
	rs("classid")=classid
	rs("sid")=special
	rs("Nkey")=Nkey
	rs("tuwen")=tuwen
	rs("width")=width
	rs("high")=high
	rs("tuaddress")=tuaddress
	if request.form("writer")<>"" then
		rs("writer")=trim(request.form("writer"))
	end if
	if request.form("writefrom")<>"" then
		rs("writefrom")=trim(request.form("writefrom"))
	end if
	rs.update
	articleid=rs("articleid")
end sub


	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
%>
<meta http-equiv="refresh" content='2; URL=admin_newsadd.asp'>
<table border="0" width="755" cellspacing="1" cellpadding="1" >
  <tr>
    <td valign=top width="20%"><!--#include file="admin_left.asp"--></td>
    <td align=center valign=top> <br>
      <table width="50%" cellpadding="1" cellspacing="1" border="0" bgcolor="#333333">
        <tr> 
          <td width="100%"  height="20" bgcolor="#999999"> 
            <p align="center"><font color="#FFFFFF"><b><%if request("action")=add then%>添加<%else%>修改<%end if%>文章成功 </b></font> 
          </td>
        </tr>
        <tr> 
          <td width="100%" bgcolor="#CCCCCC"> 
            <p align="left"><br>
              文章序号为:
              <%response.write "article"&articleid%>
              <br>
              文章标题为: 
              <%response.write title%>
            </p>
        			
            <p align="center"><b>你的操作成功!请做其他操作!<br>
			为了避免重复提交,本页面将在两秒中之内自动返回<br>
              <a  href="#" onclick="javescript:history.go(-1)"><font color="#0000FF">&gt;&gt;立即返回</font></a></b></p>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<%
else
%>
<table border="0" width="755" cellspacing="1" cellpadding="1" >
  <tr>
    <td valign=top width="20%"><!--#include file="admin_left.asp"--></td>
    <td align=center valign=top> 
      <table width="50%" cellpadding="1" cellspacing="1" border="0" bgcolor="#333333">
        <tr> 
          <td width="100%"  height="20" bgcolor="#999999"> 
            <p align="center"><font color="#FFFFFF"><b>错误提示</b></font> 
          </td>
        </tr>
        <tr> 
          <td width="100%" bgcolor="#CCCCCC">
<%
response.write "<br><center>由于以下的原因不能保存数据:<br>"
response.write errmsg&"<li><a href='javascript:history.go(-1)'>请你点击返回修改</a></li>"
response.write "<br></center>"
%>
 </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
 
<%
end if
%>

<!--#include file="copyright.asp"-->
<br>
<%
set rs=nothing
%>

</body></html>

⌨️ 快捷键说明

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