📄 admin_adminsave.asp
字号:
<!--#include file="function.asp"-->
<%CheckAdmint%>
<!--#include file="conn.asp"-->
<%
id=request("id")
action=request("action")
admin=request.form("admin")
password=request.form("password")
password2=request.form("password2")
flag=request.form("flag")
if password<>password2 then
errmsg=errmsg+"<br>"+"<li>两次输入的密码不相同!"
call error()
Response.End
end if
set rs=server.CreateObject("ADODB.RecordSet")
sql="select * from admin where flag=3"
rs.open sql,conn,1,1
if not rs.eof then
if rs.recordcount=1 and flag<>3 and Cstr(id)=Cstr(rs("id")) then
errmsg=errmsg+"<br>"+"<li>必须保留一个超级用户!"
call error()
Response.End
end if
end if
rs.close
sql="select * from admin where admin='"&admin&"'"
rs.open sql,conn,1,1
if not rs.eof then
if (Cstr(id)<>Cstr(rs("id")) and action<>"add") or action="add" then
errmsg=errmsg+"<br>"+"<li>改用户名已经存在,请另外选择一个!"
founderr=true
call error()
Response.End
end if
end if
rs.close
if action="add" and admin<>"" then
call add()
elseif action="edit" and admin<>"" then
call edit()
elseif action="del" then
call del()
end if
sub add()
sql="select * from admin"
rs.open sql,conn,1,3
rs.addnew
rs("flag")=flag
rs("admin")=admin
rs("Password")=password
rs.update
rs.close
end sub
sub edit()
sql="select * from admin where id="&id
rs.open sql,conn,1,3
if not (rs.eof and rs.bof) then
rs("flag")=flag
rs("admin")=admin
rs("Password")=Password
rs.update
end if
rs.close
end sub
sub del()
set rs=conn.execute("delete * from admin where id="&id)
end sub
set rs=nothing
conn.close
set conn=nothing
response.redirect "admin_AdminMana.asp"
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -