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

📄 admin_countyuser.asp

📁 这是去年开发的中移鼎讯手机进销存系统 大家
💻 ASP
字号:
<!--#include file="../inc/function.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../inc/ChkPurview.asp"-->
<%
dim iCount,Action
Action=Trim(request("Action"))
if GetUserGPower<>99 then			'县级用户
	Call  Msg("您没有权限",1,"")
End if
%>
<html>
<head>
<title>县级用户</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/mobile_sale.css" rel="stylesheet" type="text/css">
<SCRIPT language=javascript>
function CheckAdd()
{
  if(document.myform.username.value=="")
    {
      alert("用户名不能为空!");
	  document.form1.username.focus();
      return false;
    }
    
  if(document.myform.Password.value=="")
    {
      alert("密码不能为空!");
	  document.myform.Password.focus();
      return false;
    }
    
  if((document.myform.Password.value)!=(document.form1.PwdConfirm.value))
    {
      alert("初始密码与确认密码不同!");
	  document.form1.PwdConfirm.select();
	  document.form1.PwdConfirm.focus();	  
      return false;
    }
  if (document.myform.Purview[1].checked==true){
	GetClassPurview();
  }
}
function CheckModifyPwd()
{

  if((document.myform.Password.value)!=(document.myform.PwdConfirm.value))
    {
      alert("初始密码与确认密码不同!");
	  document.myform.PwdConfirm.select();
	  document.myform.PwdConfirm.focus();	  
      return false;
    }
}

</script>

</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="topbg"> 
    <td height="22" colspan="2" align="center"><strong>用 户 管 理</strong></td>
  </tr>
  <tr class="tdbg"> 
    <td width="70" height="30"><strong>管理导航:</strong></td>
    <td height="30"><a href="Admin_CountyUser.asp">用户首页</a>&nbsp;|&nbsp;<a href="Admin_CountyUser.asp?Action=Add">新增用户</a>
	
	</td>
  </tr>
</table>
<%

if Action="Add" then
	call AddAdmin()
elseif Action="SaveAdd" then
	call SaveAdd()
elseif Action="ModifyPwd" then
	call ModifyPwd()
elseif Action="SaveModifyPwd" then
	call SaveModifyPwd()
elseif Action="CheckList" then		'审核
	call CheckList()
elseif Action="Del" then
	call DelAdmin()
else
	call main()
end if
Call Conn_End(conn)


sub main()
	Dim CountyID
	CountyID = Request("CountyID")
'//////////////////////////////////////////////////////
	Sql = "select T_User.*,T_UserGroup.* from T_User Inner join T_UserGroup on T_UserGroup.UserGID=T_User.UserGID where CountyID='"&GetCountyID&"' order by T_User.UserID desc;"
	
'//////////////////////////////////////////////////////
	Call sql_open(Rs,Sql,Conn,1,1)
	iCount=Rs.recordcount
%>
<br>
<table width='100%' border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr align="center" class="title">
    <td height="22">组</td>
    <td>公司名</td>
    <td>用户名</td>
    <td>姓名</td>
    <td>电话</td>
    <td>状态</td>
    <td>操作</td>
    </tr>
  <%do while not Rs.EOF %>
  <tr align="center" class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'"> 
    <td><%=rs("UserGName")%></td>
    <td><%=rs("UserUnit")%></td>
    <td><a href="mailto:<%=Rs("UserEmail")%>"><%=rs("UserName")%></a></td>
    <td><%=rs("UserTrueName")%></td>
    <td><%=rs("UserTEL")%></td>
    <td><%
	if Rs("UserIsCheck")=0 then
		Response.write "<font color=""#FF0000"">未审核</font>"
	else
		Response.write "已审核"
	end if
	%></td>
    <td>
	<a href="ShowUser.asp?id=<%=Rs("UserID")%>">查看</A> | 
	<%
'	if Rs("UserGID")<>8 then
'		response.write "<a href=""Admin_CountyUser.asp?Action=ModifyPwd&id="&Rs("UserID")&""">修改权限</a> | "
'	end if
	Response.write "<a href=""Admin_CountyUser.asp?Action=CheckList&CountyID="&Rs("CountyID")&"&id="&Rs("UserID")&""">"
	if Rs("UserIsCheck")=0 then 
		Response.write "审核"
	else
		Response.write "取消"
	end if
	Response.Write "</a> | "
	if trim(Rs("UserID"))<>trim(Session("UserID")) then
		Response.Write "<a href=""Admin_CountyUser.asp?Action=Del&CountyID="&Rs("CountyID")&"&id="&Rs("UserID")&"""  onClick=""return confirm('确定要删除吗?此项操作将无法恢复!');"">删除</A>"
	end if
	%>
	
	</td>
    </tr>
  <%
		Rs.MoveNext
	Loop
  %>
</table>  
    </td>
  </tr></table>
<%
	Call Rs_End(Rs)
end sub

sub AddAdmin()
%>
<Script>
function showadv(){
if (document.myform.UserGID.value == 7) {
	bot.style.display = "";
}
if (document.myform.UserGID.value == 8) {
	bot.style.display = "none";
}
}
</Script>
<form method="post" action="Admin_CountyUser.asp" name="myform" onsubmit="javascript:return CheckAdd();">
  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" >
    <tr class="title"> 
      <td height="22" colspan="2"> <div align="center"><strong>新 增 用 户</strong></div></td>
    </tr>
    <tr class="tdbg"> 
      <td width="35%" class="tdbg"><strong> 用 户 名:</strong></td>
      <td width="65%" class="tdbg"><input name="UserName" type="text"></td>
    </tr>
    <tr class="tdbg"> 
      <td width="35%" class="tdbg"><strong> 初始密码: </strong></td>
      <td width="65%" class="tdbg"><input name="Password" type="password" id="Password"></td>
    </tr>
    <tr class="tdbg"> 
      <td width="35%" class="tdbg"><strong> 确认密码:</strong></td>
      <td width="65%" class="tdbg"><input name="PwdConfirm" type="password" id="PwdConfirm"></td>
    </tr>
    <tr class="tdbg">
      <td class="tdbg"><strong>真实姓名:</strong></td>
      <td class="tdbg"><input name="UserTrueName" type="text" id="UserTrueName"></td>
    </tr>
    <tr class="tdbg">
      <td class="tdbg"><strong>组:</strong></td>
      <td class="tdbg"><select name="UserGID" id="UserGID" onChange="showadv()">
        <%Call Opt_M("T_UserGroup","UserGID","UserGName",GetUserGID,"UserGID>='"&Cstr(GetUserGID)&"'",0)%>
      </select></td>
    </tr>
    <tr class="tdbg">
      <td class="tdbg"><strong>单位名称:</strong></td>
      <td class="tdbg"><input name="UserUnit" type="text" id="UserUnit"></td>
    </tr>	
    <tr class="tdbg">
      <td class="tdbg"><strong>库存警戒线</strong></td>
      <td class="tdbg"><input name="UserProSave" type="text" id="UserProSave" value="50" size="8" maxlength="5"></td>
    </tr>	
    <tr class="tdbg">
      <td class="tdbg"><strong>Email:</strong></td>
      <td class="tdbg"><input name="UserEmail" type="text" id="UserEmail"></td>
    </tr>
    <tr class="tdbg">
      <td class="tdbg"><strong>电话:</strong></td>
      <td class="tdbg"><input name="UserTEL" type="text" id="UserTEL"></td>
    </tr>
    <tr class="tdbg">
      <td class="tdbg"><strong>传真:</strong></td>
      <td class="tdbg"><input name="UserFax" type="text" id="UserFax"></td>
    </tr>
    <tr class="tdbg">
      <td class="tdbg"><strong> 签名: </strong></td>
      <td class="tdbg"><textarea name="UserSign" id="UserSign"></textarea></td>
    </tr>
<!--
    <tr class="tdbg" id=bot>
      <td class="tdbg"><strong>权限:</strong></td>
      <td class="tdbg"><input name="UserPower" type="radio" value="A" checked>
        超级用户
  <input name="UserPower" type="radio" id="UserPower" value="B">
审核用户(审核、拒绝)
<input name="UserPower" type="radio" id="UserPower" value="C">
普通用户(增加、修改、
删除)</td>
    </tr>
-->
    <tr> 
      <td height="40" colspan="2" align="center" class="tdbg"><input name="Action" type="hidden" id="Action" value="SaveAdd"> 
        <input  type="submit" name="Submit" value=" 添 加 " style="cursor:hand;"> 
        &nbsp; <input name="Cancel" type="button" id="Cancel" value=" 取 消 " onClick="window.location.href='Admin_CountyUser.asp'" style="cursor:hand;"></td>
    </tr>

  </table>
</form>
<%
end sub

sub ModifyPwd()
	dim UserID
	UserID=trim(Request("ID"))
	if UserID="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>请指定要修改的用户ID</li>"
		exit sub
	else
		UserID=Clng(UserID)
	end if
	sql="Select * from T_User where UserID=" & UserID
	Call sql_open(Rs,Sql,conn,1,3)
	If Rs.Bof and Rs.EOF then
		Call Msg("不存在此用户", 1,"")
	else
%>
<form method="post" action="Admin_CountyUser.asp" name="myform" onsubmit="javascript:return CheckModifyPwd();">
  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" >
    <tr class="title"> 
      <td height="22" colspan="2"> <div align="center"><strong>修 改 用 户 权 限</strong></div></td>
    </tr>
    <tr> 
      <td width="40%" class="tdbg"><strong>用 户 名:</strong></td>
      <td width="60%" class="tdbg"><%=Rs("UserName")%> <input name="ID" type="hidden" value="<%=rs("UserID")%>"></td>
    </tr>
	<%
	if trim(UserID)=trim(Session("UserID")) then
		Response.Write("<tr class=""tdbg""><td class=""tdbg"">&nbsp;</td><td class=""tdbg"">&nbsp;</td></tr>")
	else
	%>
    <tr <%
	if Rs("UserGID")=8 then
	Response.write  "style=""DISPLAY : none"""
	end if
	%>>
      <td class="tdbg"><strong>权限:</strong></td>
      <td class="tdbg"><input name="UserPower" type="radio" value="A" <%if Rs("UserPower")="A" then Response.Write("checked")%>>
        超级用户
  <input name="UserPower" type="radio" id="UserPower" value="B" <%if Rs("UserPower")="B" then Response.Write("checked")%>>
审核用户(审核、拒绝)
<input name="UserPower" type="radio" id="UserPower" value="C" <%if Rs("UserPower")="C" then Response.Write("checked")%>>
普通用户(增加、修改、
删除)</td>
    </tr>
	<%end if%>
    <tr> 
      <td colspan="2" align="center" class="tdbg"><input name="Action" type="hidden" id="Action" value="SaveModifyPwd"> 
        <input  type="submit" name="Submit" value="保存修改结果" style="cursor:hand;">
        &nbsp;
        <input name="Cancel" type="button" id="Cancel" value=" 取 消 " onClick="window.location.href='Admin_CountyUser.asp'" style="cursor:hand;"></td>
    </tr>
  </table>
</form>
<%
	end if
	Call Rs_End(Rs)
end sub
%>
</body>
</html>
<%
sub SaveAdd()
	Dim	UserName,UserPassword,PwdConfirm,UserTrueName,UserGID,CityID,CountyID,UserUnit,UserEmail,UserTEL,UserFax,UserPower,UserSign
	Dim UserProSave
	UserName	=trim(Request("UserName"))
	UserPassword=trim(Request("Password"))
	PwdConfirm	=trim(Request("PwdConfirm"))
	UserTrueName=trim(Request("UserTrueName"))
	UserGID	 	= Request("UserGID")
	CityID		= GetCityID						'添加市级时用(直接取得)
	CountyID	= GetCountyID					'添加县级
	UserProSave	= Request("UserProSave")
	UserUnit	= Request("UserUnit")
	UserEmail	= Request("UserEmail")
	UserTEL	 	= Request("UserTEL")
	UserFax	 	= Request("UserFax")
	UserPower	= Request("UserPower")
	UserSign	= Request("UserSign")

	if UserName="" then
		Call Msg("用户名不能为空", 1,"")
	end if
	if UserPassword="" then
		Call Msg("初始密码不能为空", 1,"")
	end if
	if PwdConfirm<>UserPassword then
		Call Msg("确认密码必须与初始密码相同", 1,"")
	end if

	Sql="Select * from T_User where UserName='"&UserName&"'"
	Call sql_open(Rs,Sql,conn,1,3)

	if not (Rs.bof and Rs.EOF) then
		Call Msg("数据库中已经存在此用户", 1,"")
		Call Rs_End(Rs)
		exit sub
	end if
   	Rs.addnew
 	Rs("UserName")		=UserName
   	Rs("UserPassword")	=md5(UserPassword)
	Rs("UserTrueName")	=UserTrueName
	Rs("UserGID")		=UserGID
	Rs("CityID")		=CityID	
	Rs("CountyID")		=CountyID
	Rs("UserProSave")	=UserProSave
	Rs("UserUnit")		=UserUnit
	Rs("UserEmail")		=UserEmail
	Rs("UserTEL")		=UserTEL
	Rs("UserFax")		=UserFax
	Rs("UserPower")		="C"
	
	Rs("UserSign")		=UserSign
	
	Rs.update
    Call Rs_End(Rs)
	Conn.execute("update T_UserGroup set UserNum=UserNum+1 where UserGID='" & Cstr(UserGID) & "'")

	if UserGID=6 then		'市级用户
		Response.Redirect "Admin_CountyUser.asp?CountyID=0"
	Elseif UserGID=7 then		'县级用户
		Response.Redirect "Admin_CountyUser.asp?CountyID="&CountyID&""
	Else
		Call main()
	end if
end sub

sub SaveModifyPwd()
	dim UserID,UserName,UserPassword,PwdConfirm,UserTrueName,UserGID,CityID,CountyID,UserUnit,UserEmail,UserTEL,UserFax,UserPower,UserSign
	UserID=trim(Request("ID"))
	UserPower	= Request("UserPower")

	if UserID="" then
		Call Msg("请指定要修改的用户ID", 1,"")
	else
		UserID=Clng(UserID)
	end if
	sql="Select * from T_User where UserID=" & UserID
	Call sql_open(Rs,sql,conn,1,3)
	if rs.Bof and rs.EOF then
		Call Msg("不存在此用户", 1,"")
		Call Rs_End(Rs)
		exit sub
	end if

	if trim(UserID)<>trim(Session("UserID")) then
		Rs("UserPower")		=UserPower
	end if	

	
 	rs.update
	Call Rs_End(Rs)
	call Msg("保存成功",1,"")
'	if UserGID=6 then		'市级用户
'		Response.Redirect "Admin_CountyUser.asp?CountyID=0"
'	Elseif UserGID=7 then		'县级用户
'		Response.Redirect "Admin_CountyUser.asp?CountyID="&CountyID&""
'	Else
		Call main()
'	end if
end sub
'////审核///
Sub CheckList()
	dim UserID,CountyID
	CountyID=Request("CountyID")
	UserID=trim(Request("ID"))
	If CountyID ="" then
		CountyID = 0
	End if
	if UserID=trim(Session("UserID")) then
		Call Msg("您不能审核您自己", 1,"")
	end if
	if UserID="" then
		Call Msg("请指定要审核的用户", 1,"")
	else
		UserID=Clng(UserID)
	end if
	Sql="Select * from T_User where UserID=" & UserID
	Call Sql_Open(Rs,Sql,Conn,1,3)
	if Rs.Bof and Rs.EOF then
		Call Msg("不存在此用户", 1,"")
		Call Rs_End(Rs)
		exit sub
	end if
	if Rs("UserIsCheck")=0 then
		Rs("UserIsCheck")=1
	else
		Rs("UserIsCheck")=0
	end if
 	Rs.update
	Call Rs_End(Rs)
    Response.Redirect "Admin_CountyUser.asp?CountyID="&CountyID&""
end sub

sub DelAdmin()
	dim UserID,CountyID
	CountyID=Request("CountyID")
	UserID=trim(Request("ID"))
'//////////////////////////////////
	if UserID=trim(Session("UserID")) then
		Call Msg("您不能删除您自己", 1,"")
	end if
'//////////////////////////////////	
	If CountyID ="" then
		CountyID = 0
	End if
	if UserID="" then
		Call Msg("请指定要删除的用户ID", 1,"")
		exit sub
	end if
	if instr(UserID,",")>0 then
		UserID=replace(UserID," ","")
		sql="Select * from T_User where UserID in (" & UserID & ")"
	else
		UserID=clng(UserID)
		sql="select * from T_User where UserID=" & UserID
	end if
	Call Sql_open(Rs,Sql,Conn,1,3)
	do while not rs.eof

		rs.delete
		rs.update
		rs.movenext
	loop
	Call Rs_End(Rs)
	Response.Redirect "Admin_CountyUser.asp?CountyID="&CountyID&""
end sub

%>

⌨️ 快捷键说明

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