user.asp
上传用户:apresys
上传日期:2021-03-30
资源大小:813k
文件大小:13k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

DOS

  1. <!--#include file="conn.asp"-->
  2. <!--#include file="checkuser.asp"-->
  3. <!--#include file="md5.asp" -->
  4. <%
  5. if oskey<>"supper" then
  6. response.Write "<script language=javascript>alert('您无权访问!');window.close();</script>"
  7. response.end
  8. end if
  9. %>
  10. <html>
  11. <head>
  12. <title>∷汽车4S店配件仓储管理系统:.</title>
  13. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  14. <link href="css/main.css" rel="stylesheet" type="text/css">
  15. <SCRIPT language=JavaScript src="css/User_Info_Modify.js"></SCRIPT>
  16. <style type="text/css">
  17. <!--
  18. td {  font-family: "宋体"; font-size: 9pt}
  19. body {  font-family: "宋体"; font-size: 9pt}
  20. select {  font-family: "宋体"; font-size: 9pt}
  21. A {text-decoration: none; color: #336699; font-family: "宋体"; font-size: 9pt}
  22. A:hover {text-decoration: underline; color: #FF0000; font-family: "宋体"; font-size: 9pt} 
  23. -->
  24. </style>
  25. <SCRIPT LANGUAGE=javascript>
  26. <!--
  27. function Juge(powersearch)
  28. {
  29. if (powersearch.username.value == "")
  30. {
  31. alert("用户名称不能为空!");
  32. powersearch.username.focus();
  33. return (false);
  34. }
  35. }
  36. function SelectAll() {
  37. for (var i=0;i<document.selform.selBigClass.length;i++) {
  38. var e=document.selform.selBigClass[i];
  39. e.checked=!e.checked;
  40. }
  41. }
  42. //-->
  43. </script>
  44. </HEAD>
  45. <BODY topMargin=0 rightMargin=0 leftMargin=0>       
  46. <!--#include file="top.asp"-->
  47. <%
  48.   select case request("action")
  49.   case "add"
  50.        call SaveAdd()
  51.   case "modify"
  52.        call SaveModify()
  53.   case "del"
  54.        call delCate()
  55.   case "edit"
  56.        isEdit=True
  57.        call myform(isEdit)
  58.   case else
  59.        isEdit=False
  60.        call myform(isEdit) 
  61.   end select
  62.   
  63. sub SaveAdd   
  64. set rs=server.createobject("adodb.recordset") 
  65. sql="select * from userinfo"
  66. rs.open sql,conn,1,3
  67. rs.addnew
  68. rs("name") = trim(request.Form("username"))
  69. rs("fullname") = trim(request.Form("fullname"))
  70. rs("depname") = trim(request.Form("depname"))
  71. rs("oskey") = trim(request.Form("oskey"))
  72. rs("pwd") = md5(request.Form("pwd"))
  73. rs.update
  74. response.Write "<script language=javascript>alert('添加成功!');</script>"
  75. response.write "<meta http-equiv=""refresh"" content=""0;url=user.asp"">"
  76. response.end
  77. rs.close
  78. set rs=nothing
  79. end sub
  80.  
  81. sub SaveModify
  82. passwd=request.form("pwd")
  83. passwd1=md5(trim(request.form("pwd")))   
  84. set rs=server.createobject("adodb.recordset") 
  85. sql="select * from userinfo where userid="&request.Form("userid")
  86. rs.open sql,conn,1,3
  87. rs("name") = trim(request.Form("username"))
  88. rs("fullname") = trim(request.Form("fullname"))
  89. rs("depname") = trim(request.Form("depname"))
  90. rs("oskey") = trim(request.Form("oskey"))
  91. if passwd<>rs("pwd") then
  92. rs("pwd")=passwd1
  93. end if
  94. rs.update
  95. response.Write "<script language=javascript>alert('修改成功!');</script>"
  96. response.write "<meta http-equiv=""refresh"" content=""0;url=user.asp"">"
  97. response.end
  98. rs.close
  99. set rs=nothing
  100. end sub   
  101.  
  102.   sub delCate()
  103.         conn.execute("delete from userinfo where userid in ("&Request.Form("selBigClass")&")")
  104. response.Write "<script language=javascript>alert('删除成功!');</script>"
  105. response.write "<meta http-equiv=""refresh"" content=""0;url=user.asp"">"
  106. response.end
  107.   end sub
  108.   %> <% sub myform(isEdit) %>    
  109. <TABLE width=98% align=center border="1" cellspacing="0" bordercolor="#D6D3CE">
  110.   <TBODY> 
  111.   <TR> 
  112.     <td align="center" valign="top"> 
  113. <fieldset style="width:98%"><legend>
  114. <%
  115.     
  116.    if isedit then
  117.    set rs=server.createobject("adodb.recordset")
  118.    rs.open "select * from userinfo where userid=" & request("userid"),conn,1,1
  119.        response.write "编辑用户信息"
  120.    else
  121.        response.write "添加用户信息"
  122.    end if %></legend>
  123.         <table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#D4D0C8">
  124.           <tr class="but"> 
  125. <td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">用户名</td>
  126.             <td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">全 名</td>
  127. <td width="5%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">密 码</td>
  128. <td width="15%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">登陆次数</td>
  129. <td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">上次登陆</td>
  130. <td width="15%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">上次时间</td>
  131. <td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">部 门</td>
  132. <td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">权 限</td>
  133.           </tr>
  134.   <form name="powersearch" method="post" action="user.asp" onSubmit="return Juge(this)" >
  135.   <tr> <input type="Hidden" name="action" value='<% If isedit then%>modify<% Else %>add<% End If %>'> 
  136.   <% If isedit then%><input type="Hidden" name="userid" value="<%=rs("userid")%>"> <% End If %>
  137.             <td height="18" align="center">
  138. <input name="username"  type="text"  size="10"  value='<% if isedit then
  139.                                                          response.write rs("name")
  140.   end if %>'></td>
  141.             <td>
  142. <input name="fullname"  type="text"  size="10"  value='<% if isedit then
  143.                                                          response.write rs("fullname")
  144.   end if %>'></td>
  145.             <td>
  146. <input name="pwd" onMouseOver="this.focus()"  onfocus="this.select()" type="password" size="15"  value='<% if isedit then
  147.                                                          response.write rs("pwd")
  148.   end if %>'></td>
  149. <td align="center"><input readonly name="logins" type="text"  size="10" value='<% if isedit then
  150.                                                          response.write rs("logins")
  151.   end if %>'></td>
  152. <td>
  153. <input readonly name="lastlogin" type="text"  size="20" value='<% if isedit then
  154.                                                          response.write rs("lastlogin")
  155.   end if %>'>
  156. </td>
  157. <td><input readonly name="lastip" type="text"  size="20" value='<% if isedit then
  158.                                                          response.write rs("lastip")
  159.   end if %>'>
  160. </td>
  161. <td><select name="depname"  size="1" style='width:80'>
  162. <%
  163. set rs3=server.createobject("adodb.recordset")
  164.    rs3.open "select * from department",conn,1,1
  165.    if not rs3.eof then
  166.    do while not rs3.eof
  167. %>
  168. <option <% if isedit then
  169. if trim(rs3("depname"))=trim(rs("depname")) then
  170. %> selected="selected"<%end if%><%end if%>><%=rs3("depname")%></option>
  171. <%
  172. rs3.movenext
  173. loop
  174. end if
  175. rs3.close
  176. set rs3=nothing
  177. %>
  178. </select></td>
  179. <td><select name="oskey"  size="1" style="width:80">
  180. <option value="supper" <% if isedit then
  181. if trim(rs("oskey"))="supper" then
  182. %> selected="selected"<%end if%><%end if%>>超级管理员</option>
  183. <option value="admin" <% if isedit then
  184. if trim(rs("oskey"))="admin" then
  185. %> selected="selected"<%end if%><%end if%>>一般管理员</option>
  186. <option value="general" <% if isedit then
  187. if trim(rs("oskey"))="general" then
  188. %> selected="selected"<%end if%><%end if%>>普通用户</option>
  189. </td>
  190.           </tr>
  191.    <tr>
  192. <td colspan="8" align="center"><input type="submit"  value="<% if isedit then
  193.                                                          response.write "编辑"
  194.  else
  195.  response.write "添加"
  196.   end if %>"> </td>
  197.           </tr></form>
  198.   
  199.            </table>
  200.         </fieldset>
  201.       <TABLE cellSpacing=1 cellPadding=0 width="100%" border=0 >
  202.         <TR>
  203.           <TD height="25" align="center">用 户 列 表</TD>
  204.               </TR>
  205.             </TABLE>
  206. <form action="user.asp" method="post" name="selform" >
  207.   <table width="100%"  border="1" cellpadding="0" cellspacing="0" bordercolor="#D4D0C8" align="center">
  208.     <tr> 
  209.       
  210.       <td width="100%" align="center" valign="top">
  211.   <fieldset style="width:95%">
  212.         <table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#D4D0C8">
  213.           <tr class="but"> 
  214. <td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">用户名</td>
  215.             <td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">全 名</td>
  216. <td width="15%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">部 门</td>
  217. <td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">权 限</td>
  218. <td width="6%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">登陆次数</td>
  219. <td width="15%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">上次登陆</td>
  220. <td width="8%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">上次IP</td>
  221.             <td width="5%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">操 作</td>
  222.           </tr>
  223.  <%
  224. set rs=server.CreateObject("ADODB.RecordSet") 
  225. rs.Source="select* from userinfo order by -userid"
  226. rs.Open rs.Source,conn,1,1
  227. if not rs.EOF then
  228. do while not rs.eof
  229. %>
  230. <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>
  231. <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%>&nbsp;<%end if%></td>
  232. <td height="18" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">&nbsp;<%=rs("depname")%></td>
  233. <td height="18" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">&nbsp;<%if rs("oskey")="supper" then%>超级管理员<%else%><%if rs("oskey")="admin" then%>一般管理员<%else%><%if rs("oskey")="general" then%>普通用户<%end if%><%end if%><%end if%></td>
  234. <td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><%=rs("logins")%></td>
  235. <td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><%=rs("lastlogin")%></td>
  236. <td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><%=rs("lastip")%></td>
  237. <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>
  238. </tr>
  239. <%
  240. rs.MoveNext
  241. loop
  242. end if
  243. rs.close
  244. set rs=nothing
  245. %>
  246. <tr><td align="right" colspan="10" height="22">
  247.         <input type="checkbox" name="checkbox" value="checkbox" onClick="javascript:SelectAll()"> 选择/反选
  248.               <input onClick="{if(confirm('此操作将删除该信息!nn确定要执行此项操作吗?')){this.document.selform.submit();return true;}return false;}" type=submit value=删除 name=action2> 
  249.               <input type="Hidden" name="action" value='del'></td></tr>
  250.         </table>
  251. </fieldset>
  252.   
  253. </td>
  254.     </tr>
  255.     <tr> 
  256.       <td height="50" colspan="3" align="center">
  257.         
  258.         </td>
  259.     </tr>
  260.   </table>
  261. </form>
  262.  
  263. </TD>
  264.               </TR>
  265.           </table>
  266.           
  267.       <table width="100%" border="0" cellspacing="0" cellpadding="4">
  268.       
  269.       </table>
  270.   </TBODY>
  271. </TABLE>
  272. <%end sub%>
  273. <P>
  274. <TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
  275.   <TBODY>
  276.   <TR vAlign=center>
  277.     <TD align=middle width="100%"><!--#include file="footer.htm"--></TD>
  278.   </TR></TBODY></TABLE></P></BODY></HTML>