📄 adminsave.asp
字号:
<!--#include file="conn.asp"-->
<%
if session("admin")="" then
response.redirect "admin.asp"
end if
%>
<!--#include file="char.asp"-->
<%
dim rs,sql
dim title
dim content
dim articleid
dim writer
dim writefrom
dim errmsg
dim founderr
founderr=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=htmlencode(request.form("txttitle"))
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 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("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 editsoft()
sql="select * from article where articleid="&request("id")
rs.open sql,conn,1,3
rs("title")=title
rs("content")=content
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
%>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body background="image/bg.gif">
<div align="center"><center>
<br><br>
<table width="50%" border="0" align=center cellpadding="4" cellspacing="1" bordercolor="#999999" bgcolor="#CCCCCC" class="border">
<tr align=center>
<td width="100%" height="20" bgcolor="#f7f7f7" class="font"><b> <font color="#333333">
<%if request("action")="add" then%>
添加
<%else%>
修改
<%end if%>
文章成功</font></b></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="font">
<p align="left"><br>
<font color="#333333">文章序号为:
<%response.write "article"&articleid%>
<br>
文章名称为:
<%response.write title%>
</font></p>
<font color="#333333">您可以进行其他操作 </font></td>
</tr>
</table>
</center></div>
<%
else
Error()
end if
%>
</body>
</html>
<%
sub Error()
response.write " <html><head><link rel='stylesheet' href='style.css'></head><body>"
response.write " <br><br><br>"
response.write " <table align='center' width='300' border='0' cellpadding='4' cellspacing='0' class='border'>"
response.write " <tr > "
response.write " <td class='title' colspan='2' height='15'> "
response.write " <div align='center'>由于以下的原因不能保存数据!</div>"
response.write " </td>"
response.write " </tr>"
response.write " <tr> "
response.write " <td align=center class='tdbg' colspan='2' height='23'> "
response.write " <br>"
response.write errmsg& " <br><br>"
response.write " <a href='javascript:onclick=history.go(-1)'>返回</a>"
response.write " <br><br></td>"
response.write " </tr> </table></body></html>"
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -