📄 user.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="checkuser.asp"-->
<!--#include file="md5.asp" -->
<%
if oskey<>"supper" then
response.Write "<script language=javascript>alert('您无权访问!');window.close();</script>"
response.end
end if
%>
<html>
<head>
<title>∷仓储管理信息系统:.</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/main.css" rel="stylesheet" type="text/css">
<SCRIPT language=JavaScript src="css/User_Info_Modify.js"></SCRIPT>
<style type="text/css">
<!--
td { font-family: "宋体"; font-size: 9pt}
body { font-family: "宋体"; font-size: 9pt}
select { font-family: "宋体"; font-size: 9pt}
A {text-decoration: none; color: #336699; font-family: "宋体"; font-size: 9pt}
A:hover {text-decoration: underline; color: #FF0000; font-family: "宋体"; font-size: 9pt}
-->
</style>
<script language="JavaScript" src="js/selectcity.js"></script>
<SCRIPT LANGUAGE=javascript>
<!--
function Juge(reg)
{
if (reg.username.value == "")
{
alert("用户名称不能为空!");
reg.username.focus();
return (false);
}
}
function SelectAll() {
for (var i=0;i<document.selform.selBigClass.length;i++) {
var e=document.selform.selBigClass[i];
e.checked=!e.checked;
}
}
//-->
</script>
</HEAD>
<BODY topMargin=0 rightMargin=0 leftMargin=0>
<!--#include file="top.asp"-->
<%
select case request("action")
case "add"
call SaveAdd()
case "modify"
call SaveModify()
case "del"
call delCate()
case "edit"
isEdit=True
call myform(isEdit)
case else
isEdit=False
call myform(isEdit)
end select
sub SaveAdd
set rs=server.createobject("adodb.recordset")
sql="select * from userinfo"
rs.open sql,conn,1,3
rs.addnew
rs("name") = trim(request.Form("username"))
rs("fullname") = trim(request.Form("fullname"))
rs("depid") = request.Form("depid")
rs("oskey") = trim(request.Form("oskey"))
rs("pwd") = md5(request.Form("pwd"))
rs("prov")=request.Form("prov")
rs("city")=request.Form("city")
rs.update
response.Write "<script language=javascript>alert('添加成功!');</script>"
response.write "<meta http-equiv=""refresh"" content=""0;url=user.asp"">"
response.end
rs.close
set rs=nothing
end sub
sub SaveModify
passwd=request.form("pwd")
passwd1=md5(trim(request.form("pwd")))
set rs=server.createobject("adodb.recordset")
sql="select * from userinfo where userid="&request.Form("userid")
rs.open sql,conn,1,3
rs("name") = trim(request.Form("username"))
rs("fullname") = trim(request.Form("fullname"))
rs("depid") = request.Form("depid")
rs("oskey") = trim(request.Form("oskey"))
if passwd<>rs("pwd") then
rs("pwd")=passwd1
end if
rs("prov")=request.Form("prov")
rs("city")=request.Form("city")
rs.update
response.Write "<script language=javascript>alert('修改成功!');</script>"
response.write "<meta http-equiv=""refresh"" content=""0;url=user.asp"">"
response.end
rs.close
set rs=nothing
end sub
sub delCate()
conn.execute("delete from userinfo where userid in ("&Request.Form("selBigClass")&")")
response.Write "<script language=javascript>alert('删除成功!');</script>"
response.write "<meta http-equiv=""refresh"" content=""0;url=user.asp"">"
response.end
end sub
%> <% sub myform(isEdit) %>
<TABLE width=98% align=center border="1" cellspacing="0" bordercolor="#D6D3CE">
<TBODY>
<TR>
<td align="center" valign="top">
<fieldset style="width:98%"><legend>
<%
if isedit then
set rs=server.createobject("adodb.recordset")
rs.open "select * from userinfo where userid=" & request("userid"),conn,1,1
response.write "编辑用户信息"
else
response.write "添加用户信息"
end if %></legend>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#D4D0C8">
<tr class="but">
<td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">用户名</td>
<td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">全 名</td>
<td width="5%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">密 码</td>
<td width="15%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">省 份</td>
<td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">城 市</td>
<td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">站 点</td>
<td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">权 限</td>
</tr>
<form name="reg" method="post" action="user.asp" onSubmit="return Juge(this)" >
<tr> <input type="Hidden" name="action" value='<% If isedit then%>modify<% Else %>add<% End If %>'>
<% If isedit then%><input type="Hidden" name="userid" value="<%=rs("userid")%>"> <% End If %>
<td height="18" align="center">
<input name="username" type="text" size="10" value='<% if isedit then
response.write rs("name")
end if %>'></td>
<td align="center">
<input name="fullname" type="text" size="10" value='<% if isedit then
response.write rs("fullname")
end if %>'></td>
<td align="center">
<input name="pwd" onMouseOver="this.focus()" onfocus="this.select()" type="password" size="15" value='<% if isedit then
response.write rs("pwd")
end if %>'></td>
<td align="center"><select name="prov" onChange="javascript:selectcity()">
<% if isedit then%><option selected><%=rs("prov")%></option><%end if %>
<option>选择</option>
</select>
<script language="javascript">
ProvinceOptionMenu();
</script>
</td>
<td align="center"><select name="city">
<% if isedit then%><option selected><%=rs("city")%></option><%end if %>
<option>选择</option>
</select>
</td>
<td><select name="depid" size="1" style='width:80'>
<%
set rs3=server.createobject("adodb.recordset")
rs3.open "select * from department",conn,1,1
if not rs3.eof then
do while not rs3.eof
%>
<option <% if isedit then
if rs3("id")=rs("depid") then
%> selected="selected"<%end if%><%end if%> value="<%=rs3("id")%>"><%=rs3("depname")%></option>
<%
rs3.movenext
loop
end if
rs3.close
set rs3=nothing
%>
</select></td>
<td>
<select name="oskey" size="1" style="width:80">
<option value="supper" <% if isedit then
if trim(rs("oskey"))="supper" then
%> selected="selected"<%end if%><%end if%>>超级管理员</option>
<option value="admin" <% if isedit then
if trim(rs("oskey"))="admin" then
%> selected="selected"<%end if%><%end if%>>一般管理员</option>
<option value="general" <% if isedit then
if trim(rs("oskey"))="general" then
%> selected="selected"<%end if%><%end if%>>普通用户</option>
</td>
</tr>
<tr>
<td colspan="8" height="25" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><input type="submit" value="<% if isedit then
response.write " 编 辑 "
else
response.write " 添 加 "
end if %>">
</td>
</tr></form>
</table>
</fieldset>
<TABLE cellSpacing=1 cellPadding=0 width="100%" border=0 >
<TR>
<TD height="25" align="center">用 户 列 表</TD>
</TR>
</TABLE>
<form action="user.asp" method="post" name="selform" >
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#D4D0C8" align="center">
<tr>
<td width="100%" align="center" valign="top">
<fieldset style="width:95%">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#D4D0C8">
<tr class="but">
<td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">用户名</td>
<td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">全 名</td>
<td width="15%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">部 门</td>
<td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">权 限</td>
<td width="6%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">登陆次数</td>
<td width="15%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">上次登陆</td>
<td width="8%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">上次IP</td>
<td width="5%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">操 作</td>
</tr>
<%
set rs=server.CreateObject("ADODB.RecordSet")
rs.Source="select* from userinfo order by -userid"
rs.Open rs.Source,conn,1,1
if not rs.EOF then
do while not rs.eof
%>
<tr><td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><a href="user.Asp?userid=<%=rs("userid")%>&action=edit"><%=rs("name")%></a></td>
<td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><%=rs("fullname")%><%if rs("fullname")="" then%> <%end if%></td>
<td height="18" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">
<%
depid=rs("depid")
set rs0=server.CreateObject("ADODB.RecordSet")
sql0="select * from department where id="&depid
rs0.open sql0,conn,1,3
if not rs0.eof then
depname=rs0("depname")
end if
rs0.close
set rs0=nothing
%>
<%=depname%></td>
<td height="18" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"> <%if rs("oskey")="supper" then%>超级管理员<%else%><%if rs("oskey")="admin" then%>一般管理员<%else%><%if rs("oskey")="general" then%>普通用户<%end if%><%end if%><%end if%></td>
<td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><%=rs("logins")%></td>
<td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><%=rs("lastlogin")%></td>
<td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><%=rs("lastip")%></td>
<td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><input name="selBigClass" type="checkbox" id="selBigClass" value="<%=rs("userid")%>"></td>
</tr>
<%
rs.MoveNext
loop
end if
rs.close
set rs=nothing
%>
<tr><td align="right" colspan="10" height="22">
<input type="checkbox" name="checkbox" value="checkbox" onClick="javascript:SelectAll()"> 选择/反选
<input onClick="{if(confirm('此操作将删除该信息!\n\n确定要执行此项操作吗?')){this.document.selform.submit();return true;}return false;}" type=submit value=删除 name=action2>
<input type="Hidden" name="action" value='del'></td></tr>
</table>
</fieldset>
</td>
</tr>
<tr>
<td height="50" colspan="3" align="center">
</td>
</tr>
</table>
</form>
</TD>
</TR>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="4">
</table>
</TBODY>
</TABLE>
<%end sub%>
<P>
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
<TBODY>
<TR vAlign=center>
<TD align=middle width="100%"><!--#include file="footer.htm"--></TD>
</TR></TBODY></TABLE></P></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -