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

📄 save.asp

📁 一个关于网站权限管理的经典例子,适合初学者
💻 ASP
字号:
<% Option explicit %>
<!-- #include file="./globals.inc" -->
<!-- #include file="./connects.inc" -->

<html>
<head>
  <title>保存该用户权限</title>
  <link href="./style/style.css" rel="stylesheet" type="text/css">
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  <meta http-equiv="Page-Enter" content="blendTrans(Duration=1.0)">
  <meta http-equiv="Page-Exit" content="blendTrans(Duration=1.0)">
</head>

<body topmargin=00 leftmargin=0 background="../images/bg.gif">

<%
  if request("allowsubmit")<>"OK" then response.end

  Dim sSQL, rs1, sAccountname, sLanmunames, arrLanmunames, i

  sAccountname = trim(request("accountname"))
  sLanmunames = trim(request("SelectedItem"))

  arrLanmunames = split(sLanmunames, ",", -1, 1)

 '首先删除本帐户原来所有的记录:
  sSQL = "delete from tabQXB where f_accountname='" & sAccountname & "'"
  response.write sSQL
  Set rs1 = Server.CreateObject("ADODB.Recordset")
  rs1.open sSQL, sConn, 1, 3
  set rs1 = nothing

 '再插入本帐户新的 0条、一条 或多条记录:
  if trim(arrLanmunames(i))<>"无" then
    Set rs1 = Server.CreateObject("ADODB.Recordset")
    for i=0 to ubound(arrLanmunames)
      sSQL = "insert into tabQXB (f_AccountName, f_lanmuname) values ('"& sAccountname &"', '"& trim(arrLanmunames(i)) &"')"
      rs1.open sSQL, sConn, 1, 1
    next
    set rs1 = nothing
  end if
%>

<table width="99%" border="1" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td> 帐户 <%=sAccountname%> 的权限设置完毕。 </td>
  </tr>
</table>

<script language="javascript">
  this.location="index.asp";
</script>

⌨️ 快捷键说明

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