?? admin_countyuser.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> | <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;">
<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""> </td><td class=""tdbg""> </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;">
<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 + -