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

📄 user.asp

📁 网上购物系统
💻 ASP
字号:
<!--#include file="menkan.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="page.asp"-->
<%
action=request.QueryString("action")
edit=request.QueryString("edit")
uid=request.QueryString("uid")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="Image/Main.css" rel="stylesheet" type="text/css" />
<title>会员管理</title>
</head>
<body>
<!--#include file="top.asp"-->
<%if action="list" then%>
<table width="760" border="1"align="center" cellpadding="3" cellspacing="1" bordercolor="#CCCCCC" style="border-collapse: collapse">
  <tr>
    <td colspan="5">【<a href="?action=list">会员列表</a>】【<a href="?action=user">添加会员</a>】</td>
  </tr>
  <tr>
    <td colspan="5" align="center" bgcolor="#eeeeee">会员列表</td>
  </tr>
  <tr>
    <td width="5%" align="center">ID</td>
    <td width="35%" align="center">会员帐号</td>
    <td width="20%" align="center">会员等级</td>
    <td width="20%" align="center">定单</td>
    <td width="20%" align="center">管理操作</td>
  </tr>
<%
Set mypage=new xdownpage
mypage.getconn=conn
mypage.getsql="select * from users order by UID asc"
mypage.pagesize=16
set rspage=mypage.getrs()
Response.Write("<br/>")
for i=1 to mypage.pagesize
if not rspage.eof then
%>  
  <tr>
    <td align="center"><%=rspage("uid")%></td>
    <td align="left"><%=rspage("uname")%></td>
    <td align="center">
<%
if rspage("uadmin")=true then
response.write "管理员"
else
response.write "会员"
end if
%>	
	</td>
    <td align="center">
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from orders where userid="&rspage("uid")
rs.open sql,conn,1,1
response.Write rs.recordcount
rs.close
set rs=nothing
%>	</td>
    <td align="center">
	<a href="?action=user&edit=true&uid=<%=rspage("uid")%>">编辑</a>|
	<a href="#" onClick="if(confirm('确定删除吗?这将删除此会员下所有信息'))location.href='?action=del&uid=<%=rspage("uid")%>';else return;">删除</a></td>
  </tr>
<%
rspage.movenext
else
exit for
end if
next
%>  
  <tr>
    <td colspan="5" align="right"><%mypage.showpage()%></td>
  </tr>
</table>
<%
Set mypage=nothing
end if
%>
<%
if action="user" then
if edit="true" then
set rs=server.CreateObject("adodb.recordset")
sql="select * from users where uid="&uid
rs.open sql,conn,1,1
uname=rs("uname")
uadmin=rs("uadmin")
udian=rs("udian")
utel=rs("utel")
udizhi=rs("udizhi")
uyoubian=rs("uyoubian")
uxingming=rs("uxingming")
rs.close
set rs=nothing
end if
%>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="14"></td>
  </tr>
</table>
<table width="760" border="1"align="center" cellpadding="3" cellspacing="1" bordercolor="#CCCCCC" style="border-collapse: collapse">
<form method="post" name="class" <%if edit<>"true" then%> action="?action=save"<%else%>action="?action=save&edit=true&uid=<%=uid%>"<%end if%>>
  <tr>
    <td colspan="2">【<a href="?action=list">会员列表</a>】【<a href="?action=user">添加会员</a>】</td>
  </tr>
  <tr>
    <td colspan="2" align="center" bgcolor="#eeeeee">
<%
if edit="true" then
response.Write("编辑会员")
else
response.Write("添加会员")
end if
%>	</td>
  </tr>
  <tr>
    <td width="20%" align="center">会员账号</td>
    <td>
<%if edit="true" then%>
<%=uname%>
<%else%>
<input name="uname" type="text" id="uname">
*4~12位
<%end if%></td>
  </tr>
  <tr>
    <td align="center">登陆密码</td>
    <td><input name="upassword" type="password" id="upassword">
      *4~20位</td>
  </tr>
  <tr>
    <td align="center">会员积分</td>
    <td><input name="Udian" type="text" id="Udian" <%if edit="true" then%> value="<%=Udian%>"<%end if%>></td>
  </tr>
  <tr>
    <td align="center">是否管理员</td>
    <td>
<%if edit="true" then%>
	<input name="uadmin" type="radio" value="false" <%if uadmin=false then%>checked<%end if%>>会员
    <input type="radio" name="uadmin" value="true"  <%if uadmin=true  then%>checked<%end if%>>管理员
<%else%>	
	<input name="uadmin" type="radio" value="false" checked>会员
    <input type="radio" name="uadmin" value="true">管理员
<%end if%>	</td>
  </tr>
  
  <tr>
    <td align="center">姓  名</td>
    <td><input name="uxingming" type="text" id="uxingming" <%if edit="true" then%>value="<%=uxingming%>"<%end if%>></td>
  </tr>
  <tr>
    <td align="center">联系电话</td>
    <td><input name="utel" type="text" id="utel" <%if edit="true" then%>value="<%=utel%>"<%end if%>></td>
  </tr>
  <tr>
    <td align="center">地  址</td>
    <td><input name="udizhi" type="text" id="udizhi" <%if edit="true" then%>value="<%=udizhi%>"<%end if%>></td>
  </tr>
  <tr>
    <td align="center">邮政编码</td>
    <td><input name="uyoubian" type="text" id="uyoubian" <%if edit="true" then%>value="<%=uyoubian%>"<%end if%>></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="Submit" value="提交">
    <input type="reset" name="Submit2" value="重置"></td>
  </tr>
</form> 
</table>
<%end if%>
<!--#include file="foot.asp"-->
</body>
</html>
<%
if action="save" then
edit=request.QueryString("edit")
uname=request.Form("uname")
upassword=request.Form("upassword")
uadmin=request.Form("uadmin")
udian=request.Form("udian")
uxingming=request.Form("uxingming")
utel=request.Form("utel")
udizhi=request.Form("udizhi")
uyoubian=request.Form("uyoubian")
if edit<>"true" then
if uname="" or len(uname)<4 or len(uname)>12 then
	response.write "<SCRIPT language=JavaScript>alert('请输入用户名称,且不得小于4大于12个字!');"
	response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
	Response.End
end if
end if

if upassword="" or len(upassword)<4 or len(upassword)>20 then
	response.write "<SCRIPT language=JavaScript>alert('请输入密码,且不得小于4大于20个字!');"
	response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
	Response.End
end if
if uadmin="" then
	response.write "<SCRIPT language=JavaScript>alert('参数错误!');"
	response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
	Response.End
end if
if udian="" then
	response.write "<SCRIPT language=JavaScript>alert('请输入会员点数!');"
	response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
	Response.End
end if
if uxingming="" then
	response.write "<SCRIPT language=JavaScript>alert('请输入姓名!');"
	response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
	Response.End
end if
if utel="" then
	response.write "<SCRIPT language=JavaScript>alert('请输入联系电话!');"
	response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
	Response.End
end if
if udizhi="" then
	response.write "<SCRIPT language=JavaScript>alert('请输入地址!');"
	response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
	Response.End
end if
if uyoubian="" then
	response.write "<SCRIPT language=JavaScript>alert('请输入邮政编码!');"
	response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
	Response.End
end if
set rs=server.CreateObject("adodb.recordset")
if edit="true" then
sql="select * from users where uid="&uid
rs.open sql,conn,1,3
else
sql="select * from users"
rs.open sql,conn,1,3
rs.addnew
rs("uname")=uname
end if
rs("upassword")=upassword
rs("uadmin")=uadmin
rs("udian")=udian
rs("uxingming")=uxingming
rs("utel")=utel
rs("udizhi")=udizhi
rs("uyoubian")=uyoubian
rs.update
rs.close
set rs=nothing
response.Redirect "?action=list"
end if

if action="del"then
if uid=1 then
	response.write "<SCRIPT language=JavaScript>alert('此为管理员账号不能删除!');"
	response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
	Response.End
end if
'删除USER表中的相关数据
conn.execute("delete * from users where uid="&uid)
'查询orders表中相应的OrderId
strSql="select OrderId,UserId from orders where UserId="&uid
Set rs=conn.Execute(strSql)
OrderId=rs("OrderId")
'删除Orders_Particular表中相关数据
conn.execute("delete * from Orders_Particular where orderid="&OrderId)
'删除Orders表中相关数据
conn.execute("delete * from orders where UserId="&uid)
'删除shouhou表中相关数据
conn.execute("delete * from shouhou where userid="&uid)
response.Write"<script>alert('删除完成!');location.href('?action=list');</script>"
end if
%>

⌨️ 快捷键说明

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