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

📄 admin_authorsave.asp

📁 3000首FLASH源程序
💻 ASP
字号:
<!--#include file="function.asp"-->
<%CheckAdmins%>
<!--#include file="top.asp"-->
<%	dim founderr,errmsg
	if request.form("author")="" then
  		founderr=true
  		errmsg=errmsg+"<li>作者姓名不能为空</li>"
	else
		author=request.form("author")
	end if
	if request.form("Nkey")="" then
  		founderr=true
  		errmsg=errmsg+"<li>姓名首写拼音不能为空</li>"
	else
		Nkey=request.form("Nkey")
	end if
	if request.form("address")="" then
  		founderr=true
  		errmsg=errmsg+"<li>作者籍贯不能为空</li>"
	else
		address=request.form("address")
	end if
	if request.form("birthday")<>"" then
		birthday=request.form("birthday")
	else
		if request.form("year")<>"" then birthday=request.form("year")+"年"
		if request.form("month")<>"" then birthday=birthday+request.form("month")+"月"
		if request.form("date")<>"" then birthday=birthday+request.form("date")+"日"
	end if
	if request.form("images")<>"" then
		images=request.form("images")
	else
		images=""
	end if
	if request.form("tv")<>"" then
		tv=request.form("tv")
	else
		tv=""
	end if
	if request.form("content")<>"" then
		content=request.form("content")
	else
		content="暂无"
	end if
	sex=request.form("sex")
	if founderr=true then
		call error()
		response.end
	end if
	if request("action")="add" then
		call add()
		if founderr<>true then call success()
	elseif request("action")="edit" then
		call edit()
		if founderr<>true then call success()
	else
		founderr=true
		errmsg=errmsg+"<li>没有选定参数</li>"
	end if

sub add()
	sql="select * from author where author='"&author&"'"
	rs.open sql,conn,1,3
	if not rs.eof then
	founderr=true
  	errmsg=errmsg+"<br><li>对不起,您所添加的作者<font color=#ff0000>"&author&"</font>已经存在于数据库中!</li>"
	else
	rs.addnew
	rs("author")=author
	rs("sex")=sex
	rs("images")=images
	rs("tv")=tv
	rs("address")=address
	rs("birthday")=birthday
	rs("content")=content
	rs("Nkey")=Nkey
	rs("hits")=0
	rs.update
	end if
	rs.close
end sub

sub edit()
	if request("id")="" then 
		founderr=true
		errmsg=errmsg+"<li>操作错误</li>"
	else
		if request.form("oldauthor")<>author then
		sql="select author from author where author='"&author&"'"
		rs.open sql,conn,1,1
			if not rs.eof then
				founderr=true
				errmsg=errmsg+"<br><li>对不起,您所修改的作者名<font color=#ff0000>"&author&"</font>已经存在于数据库中!</li>"
				call error()
				response.end
			end if
		rs.close
		end if
	sql="select * from author where authorid="&request("id")
	rs.open sql,conn,1,3
	rs("author")=author
	rs("sex")=sex
	rs("images")=images
	rs("tv")=tv
	rs("address")=address
	rs("birthday")=birthday
	rs("content")=content
	rs("Nkey")=Nkey
	rs.update
	rs.close
	end if
end sub
%>
<%sub success()
response.write "<table width=770 border=0 cellspacing=1 cellpadding=1 align=center bgcolor="&Tablebackcolor&">"&_
  "<tr> "&_
    "<td width=157 bgcolor="&Tabletitlecolor&">"&_
 "</td>"&_
    "<td width=609 bgcolor="&Tabletitlecolor&"><div align=center><br><br>恭喜,作者"
        if request("action")="add" then
        response.write"添加"
		else
        response.write"修改"
        end if
        response.write"成功!<br><br>"&_
            "<input type=button value=关 闭 onclick=javascript:self.close()> "&_
            "<input type=button value=返 回 onclick=javascript:history.go(-1)>"&_
		"</div>"&_
	"</td>"&_
  "</tr>"&_
"</table>"
end sub
if founderr=true then call error()
set rs=nothing
conn.close
set conn=nothing
%>
<!--#include file="copyright.asp"-->
</body>
</html>

⌨️ 快捷键说明

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