📄 adminsave.asp
字号:
<%
if session("admin")="" then
response.redirect "admin.asp"
end if
%>
<!--#include file="conn.asp"-->
<%
dim rs,sql
dim title
dim content
dim articleid
dim classid,Nclassid
dim writer
dim articleon
dim ding
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 founderr=false then
title=request.form("txttitle")
classid=request.form("classid")
Nclassid=request.form("Nclassid")
articleon=request.form("articleon")
ding=request.form("ding")
content=Replace(request.form("txtcontent"), CHR(10), "\")
set rs=server.createobject("adodb.recordset")
if request("action")="add" then
call newsoft()
elseif request("action")="edit" then
call editsoft()
else
founderr=true
errmsg=errmsg+"<li>没有选定参数</li>"
end if
sub newsoft()
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("articleon")=articleon
rs("ding")=ding
rs("hits")=0
if request.form("writer")<>"" then
rs("writer")=trim(request.form("writer"))
end if
rs("dateandtime")=now
rs.update
articleid=rs("articleid")
end sub
sub editsoft()
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("articleon")=articleon
rs("ding")=ding
if request.form("writer")<>"" then
rs("writer")=trim(request.form("writer"))
end if
rs.update
articleid=rs("articleid")
end sub
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div align="center"><center>
<br><br>
<table width="50%" border="1" cellpadding="0" cellspacing="0" bordercolor="#999999">
<tr>
<td width="100%" bgcolor="#999999" height="20"><p align="center"><font color="#FFFFFF"><b>
<%if request("action")=add then%>添加<%else%>修改<%end if%>文章成功</b></font></td>
</tr>
<tr>
<td width="100%"><p align="left"><br>
文章序号为:<%response.write "article"&articleid%><br>
文章标题为:<%response.write title%></p>
您可以进行其他操作
</td>
</tr>
</table>
</center></div>
<%
else
response.write "由于以下的原因不能保存数据:"
response.write errmsg
end if
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -