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

📄 admin_account.asp

📁 多功能在线报价系统源码多功能在线报价系统源码
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% Option Explicit %>
<!-- #include file="conn_CompMarket.asp" -->
<!-- #include file="adovbs.inc" -->
<%
Dim rsUserInfo '储存用户帐号
%>
<html>

<head>
<meta http-equiv="Content-UserInfo" content="text/html; charset=gb2312">
<title>“用户帐号”管理</title>
<link href="priceEdit.css" rel="stylesheet" type="text/css">
</head>

<body>
<%
'删除用户帐号-开始
If request.querystring("command")="delete" then
	If request.form("Submit")="删除" then
		Dim User_ID '储存用户编号
		'用户编号通过“hidden”属性的“input”表单元素来传递
		User_ID=request.form("User_ID")
		'设置当前查询所要操作的表和相应的SQL语句
		rsSource="UserInfo"
		rsSQL="delete "&rsSource&" where [UserID]='"&User_ID&"'"
		'建立记录集对象,开始查询
		'删除被选中的用户
		set rsUserInfo=Server.CreateObject("ADODB.Recordset")
		rsUserInfo.Open rsSQL,dcnCompMarket,1,2,1
		If rsUserInfo.State=adStateOpen Then rsUserInfo.Close
		set rsUserInfo=Nothing
	End If
%>
<%
'设置当前查询所要操作的表和相应的SQL语句
rsSource="UserInfo"
rsSQL="select * from "&rsSource
'建立记录集对象,开始查询
set rsUserInfo=Server.CreateObject("ADODB.Recordset")
rsUserInfo.Open rsSQL,dcnCompMarket,1,2,1
%>
<table width="800" border="0" bgcolor="#999999">
<tr><td>
	<table border="1" width="100%" cellpadding="1">
	<tr><td align="center"><b>用户</b></td>
		<td align="center"><b>操作</b></td>
	</tr>
<%
'给出用户列表,给出“删除”按钮
Do While NOT rsUserInfo.EOF
	Response.Write("<form Method=""post"" Action=""admin_Account.asp?command=delete"">")
	'通过“hidden”属性的“input”表单元素来传递“用户编号”
	Response.Write("<input type=""hidden"" name=""User_ID"" value=""" & _
		rsUserInfo.Fields("UserID") & """>")
	Response.Write("<tr><td align=""center"">" & rsUserInfo.Fields("UserID") & "</td>" & _
		"<td align=""center""><input type=""submit"" name=""Submit"" value=""删除""></td></tr>")
	Response.Write("</form>")
	rsUserInfo.MoveNext
Loop

'使用完毕后关闭数据库连接
rsUserInfo.Close
set rsUserInfo=Nothing
%>
	</table>
</td></tr>
</table>
<%
'删除用户帐号-结束
End If
%>

<%
'修改用户密码-开始
If request.querystring("command")="change" then
	Dim UserID	'储存当前用户名
	Dim UserPWD	'储存当前用户密码
	If session("UserID")="" then
%>
<script language="JavaScript">
		parent.location.href="login.asp"
</script>
<%		
	Else
		UserID=session("UserID")
	End If
	UserPWD=request.form("UserPWD")
	If request.form("Submit")="修改" and not UserPWD="" then
		'设置当前查询所要操作的表和相应的SQL语句
		rsSource="UserInfo"
		rsSQL="update "&rsSource&_
			" set [UserPWD]='"&UserPWD&"'"&_
			" where [UserID]='"&UserID&"'"
		'建立记录集对象,开始查询
		'修改被选中的用户
		set rsUserInfo=Server.CreateObject("ADODB.Recordset")
		rsUserInfo.Open rsSQL,dcnCompMarket,1,2,1
		If rsUserInfo.State=adStateOpen Then rsUserInfo.Close
		set rsUserInfo=Nothing
	End If
%>
<%
'设置当前查询所要操作的表和相应的SQL语句
rsSource="UserInfo"
rsSQL="select * from "&rsSource&" where [UserID]='"&UserID&"'"
'建立记录集对象,开始查询
set rsUserInfo=Server.CreateObject("ADODB.Recordset")
rsUserInfo.Open rsSQL,dcnCompMarket,1,2,1
%>
<table width="800" border="0" bgcolor="#999999">
<tr><td>
	<table border="1" width="100%" cellpadding="1">
	<tr><td align="center"><b>当前用户</b></td>
		<td align="center"><b>密码</b></td>
		<td align="center"><b>操作</b></td>
	</tr>
<%
'给出用户列表,给出“修改”按钮
Do While NOT rsUserInfo.EOF
	Response.Write("<form Method=""post"" Action=""admin_Account.asp?command=change"">")
	'通过“hidden”属性的“input”表单元素来传递“用户编号”
	Response.Write("<tr><td align=""center"">" & UserID &"</td><td>"&_
			"<input type=""text"" size=""10"" name=""UserPWD"" value=""" & rsUserInfo.Fields("UserPWD") & """>"&_
			"</td>" & _
		"<td align=""center""><input type=""submit"" name=""Submit"" value=""修改""></td></tr>")
	Response.Write("</form>")
	rsUserInfo.MoveNext
Loop

'使用完毕后关闭数据库连接
rsUserInfo.Close
set rsUserInfo=Nothing
%>
	</table>
</td></tr>
</table>
<%
'修改用户密码-结束
End If
%>

<%
'添加用户帐号-开始
If request.querystring("command")="add" Then
	If request.form("Submit")="添加用户" and _
	 not request.form("UserID")="" and _
	 not request.form("UserPWD")=""	then
		Dim newUserID  '储存新的用户名
		Dim newUserPWD '储存新用户密码
		newUserID=request.form("UserID")
		newUserPWD=request.form("UserPWD")
		'设置当前查询所要操作的表和相应的SQL语句
		rsSource="UserInfo"
		rsSQL="insert into "&rsSource&" values ('"&newUserID&"','"&newUserPWD&"')"
		'建立记录集对象,开始查询
		Set rsUserInfo=Server.CreateObject("ADODB.Recordset")
		rsUserInfo.Open rsSQL,dcnCompMarket,1,2,1
		If rsUserInfo.State=adStateOpen Then rsUserInfo.Close
		set rsUserInfo=Nothing
	End If
%>
<%
'设置当前查询所要操作的表和相应的SQL语句
rsSource="UserInfo"
rsSQL="select * from "&rsSource
'建立记录集对象,开始查询
set rsUserInfo=Server.CreateObject("ADODB.Recordset")
rsUserInfo.Open rsSQL,dcnCompMarket,1,2,1
%>
<table width="800" border="0" cellpadding="5" bgcolor="#999999">
<tr><td>
	<table border="1" align="center" cellpadding="1">
	<tr><td align="center"><b>现有用户</b></td>
	</tr>
<%
'给出用户列表
Do While NOT rsUserInfo.EOF
	Response.Write("<tr><td align=center>" & rsUserInfo.Fields("UserID") & "</td></tr>")
	rsUserInfo.MoveNext
Loop

'使用完毕后关闭数据库连接
rsUserInfo.Close
set rsUserInfo=Nothing
%>
	</table>
</td></tr>
<tr><td><form name="addUserInfo" method="post" action="admin_Account.asp?command=add">
  <table border="1" align="center" cellpadding="3">
    <tr>
      <td>新增用户</td>
      <td><input name="UserID" type="text" id="UserID" size="10"></td>
      </tr>
    <tr>
      <td>设定密码</td>
      <td><input name="UserPWD" type="text" id="UserPWD" size="10"></td>
      </tr>
    <tr>
      <td colspan="2"><div align="center">
          <input type="submit" name="Submit" value="添加用户">&nbsp;
          <input type="reset" name="Reset" value="重新输入">
      </div></td>
      </tr>
  </table>
</form>
	
</td>
</tr>
</table>

<%
'添加用户帐号-结束
End If
%>

<%
'使用完毕后关闭数据库连接
If dcnCompMarket.State=adStateOpen Then
	dcnCompMarket.Close
End If
Set dcnCompMarket=Nothing
%>
</body>
</html>

⌨️ 快捷键说明

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