xt_sys_add_update.asp
来自「用ASP写的电子购物系统」· ASP 代码 · 共 133 行
ASP
133 行
<%@ LANGUAGE = VBScript %>
<!--#INCLUDE FILE="include/manager.asp" -->
<% REM ######################################################################### %>
<% REM %>
<% REM XT_DATA_ADD_UPDATE.ASP %>
<% REM Volcano Coffee %>
<% REM 增加系统用户和用户组 %>
<% REM %>
<% REM Copyright (c) 1996-98 Microsoft Corporation. All rights reserved. %>
<% REM %>
<% REM ######################################################################### %>
<%
dim errorList
op = Request("action")
if op="" then op="add"
Select Case Request.Form("type")
Case "sysuser"
userid =checklength(request("userid"), 20)
if IsNull(userid) then
errorList=errorList & "用户编号的长度为1至20个字符。<br>"
end if
fullname = checklength(request("fullname"), 50)
if IsNull(fullname) then
errorList=errorList & "用户名的长度为1至50个字符。<br>"
end if
password = checklength(Request("password1"), 20) '品牌名
if IsNull(password) then
errorList=errorList & "用户密码的长度为1至20个字符。<br>"
end if
'short_description = mscsPage.RequestString("short_description",,,false,&H0804)
phone = checklength(request ("phone"), 20)
if IsNull(phone) then
errorList=errorList & "用户电话的长度为4至20个字符。<br>"
end if
street = checklength(request ("street"), 120)
'long_description = mscsPage.RequestString("long_description")
email =checklength(Request ("email"), 50)
groupname = Request("groupname")
'errorList.Add(Request("list_price"))
Case "sysgroup"
groupname = checklength(Request("groupname"),20)
if IsNull(groupname) then
errorList=errorList & "用户组名长度为1至20个字符。<br>"
end if
groupdesc = checklength(Request("groupdesc"),50)
if IsNull(groupdesc) then
errorList=errorList & "组描述长度为1至50个字符。<br>"
end if
Case Else
errorList="不知道的类型: " & Request("type")
End Select
if errorList= "" or op = "delete" then 'No Error
Select Case Request.Form("type")
Case "sysuser"
cmdTemp.CommandText = "SELECT * FROM sysuser WHERE userid = '" & Replace(userid, "'", "''") & "'"
Case "sysgroup"
cmdTemp.CommandText = "SELECT * FROM workgroup WHERE name = '" & Replace(groupname, "'", "''") & "'"
End Select
Set recordSet = Server.CreateObject("ADODB.Recordset")
recordSet.Open cmdTemp, , adOpenKeyset, adLockOptimistic
if (op = "add" and recordSet.RecordCount = 0) or (op = "update" and recordSet.RecordCount = 1) or (op = "delete" and recordSet.RecordCount = 1) then
if op = "add" then
recordSet.AddNew
end if
Select Case Request.Form("type")
Case "sysuser"
if op= "delete" then
recordSet.Delete
else
if op = "add" then
recordSet("userid").Value = userid
end if
recordSet("password").Value = password
recordSet("fullname").Value = fullname
recordSet("phone").Value = phone
recordSet("Street").value = street
recordSet("email").Value = email
recordSet("groupname").Value = groupname
recordSet.Update
end if
Case "sysgroup"
if op= "delete" then
recordSet.Delete
else
recordSet("name").Value = groupname
recordSet("description").Value = groupdesc
recordSet.Update
end if
End Select
Response.redirect Cstr(Request.Form("goto"))
else
if op = "add" then
Select Case Request.Form("type")
Case "sysuser"
errorList=errorList & "用户编号已存在。<br>"
Case "sysgroup"
errorList=errorList & "用户组已存在。<br>"
End Select
else
Select Case Request.Form("type")
Case "sysuser"
errorList=errorList & "错误的用户编号。<br>"
Case "sysgroup"
errorList=errorList & "错误的用户组编号。<br>"
End Select
end if
end if
end if
if errorList<>"" then
%>
<!--#INCLUDE FILE="error.asp" -->
<%
end if
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?