PageRenderTime 47ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

/username.asp

http://yongding.googlecode.com/
ASP | 317 lines | 303 code | 4 blank | 10 comment | 17 complexity | 61013cc0461a603131a5c0e43f7fbd3a MD5 | raw file
Possible License(s): GPL-2.0
  1. <!--#include file="lib/utf-8.asp"-->
  2. <!--#include file="lib/connopen.asp"-->
  3. <!--#include file="lib/asp-common-lib.asp"-->
  4. <!--#include file="lib/md5/md5.asp"-->
  5. <!DOCTYPE HTML>
  6. <html>
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  9. <title>???????</title>
  10. <!--#include file="lib/plugins.asp"-->
  11. <style type="text/css">
  12. .yform .type-check label {
  13. width: 6em;
  14. display: inline-block;
  15. }
  16. .subcl,.subcr,.subc {
  17. padding-bottom: 100em;
  18. margin-bottom: -100em;
  19. }
  20. h6 {
  21. background: #600;
  22. color: white;
  23. font-weight: bold;
  24. padding: 5px 10px;
  25. }
  26. #tablelist{
  27. font-family:??;
  28. }
  29. </style>
  30. <script type="text/javascript">
  31. $(function() {
  32. $("#form1").validationEngine();
  33. $("input:checked").next().next().prop("disabled",false);
  34. $("input[name='post']").click(function(){
  35. if($(this).prop("checked")){
  36. $(this).next().next().prop("disabled",false);
  37. }else{
  38. $(this).next().next().prop("disabled",true);
  39. }
  40. });
  41. /*
  42. $("#chkpsw").click(function(){
  43. var md5 = $.md5($("#password").val());
  44. alert($("#password").val()+':'+md5);
  45. });
  46. */
  47. $("#setpws").click(function(){
  48. $("#dv_setpws").dialog("open");
  49. });
  50. $("#dv_setpws").dialog({
  51. autoOpen: false,
  52. minHeight:200,
  53. modal: true,
  54. buttons: {
  55. "??": function() {
  56. if($("#fm_setpws").validationEngine('validate')){
  57. $.post("setpws.asp",{action:"??",password:$.md5($("#set_password").val()),username:$("#set_user").val(),checkpws:checkpws($("#set_password").val())},function(data){
  58. if(data){
  59. alert(data.sInfo);
  60. $("#dv_setpws").dialog( "close" );
  61. }
  62. },"json");
  63. }
  64. },
  65. "??": function() {
  66. $(this).dialog( "close" );
  67. }
  68. }
  69. });
  70. });
  71. </script>
  72. <!--#include file="lib/js-google-analytics.asp"-->
  73. </head>
  74. <%
  75. if not CheckPostFlag(session("aaPostFlag"),0,15) then call JumpErrorPage(2)
  76. id=request("id")
  77. submit=request("submit")
  78. If submit<>"" Then
  79. conn.BeginTrans
  80. username=LCase(request("username"))
  81. password=lcase(md5(request("password")))
  82. ' response.write password
  83. ' response.end
  84. fullname=request("fullname")
  85. active=request("active")
  86. wan=request("wan")
  87. employee=request("employee")
  88. wtr=request("wtr")
  89. if active="" then active=false
  90. if wan="" then wan=false
  91. if employee="" then employee=false
  92. if submit="??" then
  93. sql="insert into username(username,[password],fullname,active,wan,employee,wtr) values('"&username&"','"&md5(password)&"','"&fullname&"',"&active&","&wan&","&employee&","&wtr&")"
  94. 'response.write(sql)
  95. 'response.end
  96. newuserid=ExecuteCommand(sql,true)
  97. end if
  98. if submit="??" then
  99. sql="update username set username='"&username&"',fullname='"&fullname&"',active="&active&",wan="&wan&",employee="&employee&",wtr="&wtr&" where id="&id
  100. call ExecuteCommand(sql,false)
  101. sql="delete * from flag where username="&id
  102. call ExecuteCommand(sql,false)
  103. newuserid=id
  104. end if
  105. for i=1 to request.form("post").count
  106. post=request.form("post")(i)
  107. flag=request.form("flag")(i)
  108. sql="insert into flag(username,post,flag) values("&newuserid&","&post&","&flag&")"
  109. call ExecuteCommand(sql,flase)
  110. next
  111. if err.number=0 then
  112. conn.CommitTrans '????conn??????????
  113. else
  114. conn.RollbackTrans '????
  115. '????????
  116. 'strerr=err.Description
  117. url=request.ServerVariables("http_host")&request.ServerVariables("url")
  118. Response.Write "??????<br /><font color=red>Error # " & CStr(Err.Number) & "<br />" & Err.Description & "<br />Source: " & Err.Source &"<br />?????"&url&"</font><br />"
  119. Response.End
  120. end if
  121. end if
  122. if id<>"" then
  123. Set rs = Server.CreateObject("ADODB.Recordset")
  124. sql = "select * from username left join flag on username.id=flag.username where id="&id
  125. rs.Open sql,conn,1,1
  126. username=rs("username.username")
  127. password=rs("password")
  128. fullname=rs("fullname")
  129. active=rs("active")
  130. wan=rs("wan")
  131. employee=rs("employee")
  132. wtr=rs("wtr")
  133. aaFlag=rs.getrows(,,array("post","flag"))
  134. rs.close
  135. set rs=nothing
  136. ' else
  137. ' dim aaFlag(1,0)
  138. ' aaFlag(0,0)=null
  139. ' aaFlag(1,0)=null
  140. end if
  141. %>
  142. <body>
  143. <!--#include file="lib/header.asp"-->
  144. <!--#include file="lib/nav.asp"-->
  145. <div id="main">
  146. <!--#include file="lib/col1.asp"-->
  147. <!--#include file="lib/col2.asp"-->
  148. <div id="dv_setpws" title="????">
  149. <form id="fm_setpws" method="post" class="yform full" role="application">
  150. <div class="type-text">
  151. <label for="set_user">???*</label>
  152. <input name="set_user" id="set_user" type="text" readonly="readonly" value="<%=username%>" />
  153. </div>
  154. <div class="type-text">
  155. <label for="set_password">????*</label>
  156. <input name="set_password" id="set_password" type="password" maxlength="10" class="validate[required,minSize[6],maxSize[10],custom[onlyPassword]]" />
  157. </div>
  158. </form>
  159. </div>
  160. <div id="col3" role="main">
  161. <div id="col3_content" class="clearfix">
  162. <form id="form1" name="form1" method="post" class="yform" role="application">
  163. <div class="subcolumns equalize">
  164. <div class="c50l">
  165. <div class="subcl">
  166. <h6>????</h6>
  167. <div class="type-text">
  168. <label for="username">???*</label>
  169. <input name="username" class="validate[required,minSize[3],maxSize[10],custom[onlyUserName]]" maxlength="10" id="username" type="text" value="<%=username%>" />
  170. </div>
  171. <div class="type-text">
  172. <label for="password">??*</label>
  173. <%if id<>"" or newuserid<>"" then%>
  174. <button id="setpws" type="button">????</button>
  175. <%else%>
  176. <input name="password" class="validate[required,minSize[6],maxSize[10],custom[onlyPassword]]" maxlength="10" id="password" type="password" value="<%=password%>" />
  177. <%end if%>
  178. </div>
  179. <div class="type-text">
  180. <label for="fullname">??*</label>
  181. <input name="fullname" class="validate[required,minSize[2],maxSize[4]]" maxlength="4" id="fullname" type="text" value="<%=fullname%>" />
  182. </div>
  183. <div class="type-select">
  184. <label for="wtr">?????*</label>
  185. <select id="wtr" name="wtr">
  186. <%
  187. Set rs_wtr = Server.CreateObject("ADODB.Recordset")
  188. sql = "SELECT * FROM wtr order by id"
  189. rs_wtr.Open sql,conn,1,1
  190. do while not rs_wtr.eof
  191. %>
  192. <option value="<%=rs_wtr("id")%>" <%if rs_wtr("id")=wtr then response.write("selected='selected'")%>><%=rs_wtr("wtr")%></option>
  193. <%
  194. rs_wtr.movenext
  195. loop
  196. rs_wtr.close
  197. set rs_wtr=nothing
  198. %>
  199. </select>
  200. </div>
  201. <div class="type-check">
  202. <input name="active" id="active" type="checkbox" value="true" <%if active then response.write("checked='checked'")%> />
  203. <label for="active">????</label>
  204. </div>
  205. <div class="type-check">
  206. <input name="wan" id="wan" type="checkbox" value="true" <%if wan then response.write("checked='checked'")%> />
  207. <label for="wan">????</label>
  208. </div>
  209. <div class="type-check">
  210. <input name="employee" id="employee" type="checkbox" value="true" <%if employee then response.write("checked='checked'")%> />
  211. <label for="employee">????</label>
  212. </div>
  213. </div>
  214. </div>
  215. <div class="c50r">
  216. <div class="subcr">
  217. <h6>????</h6>
  218. <%
  219. Set rs_post = Server.CreateObject("ADODB.Recordset")
  220. sql_post = "SELECT * FROM post order by id"
  221. rs_post.Open sql_post,conn,1,1
  222. do while not rs_post.eof
  223. %>
  224. <div class="type-check">
  225. <input name="post" id="post<%=rs_post("id")%>" type="checkbox" value="<%=rs_post("id")%>" <%if CheckPost(aaFlag,rs_post("id")) then response.write("checked='checked'")%> />
  226. <label for="post<%=rs_post("id")%>"><%=rs_post("post")%></label>
  227. <select name="flag" disabled="disabled">
  228. <%
  229. aAuthKey=dAuthority.keys
  230. aAuthItem=dAuthority.items
  231. for iAuthLoop=0 to dAuthority.count-1
  232. %>
  233. <option value="<%=aAuthKey(iAuthLoop)%>" <%if CheckPost(aaFlag,rs_post("id")) and GetFlagValue(aaFlag,rs_post("id"))=cint(aAuthKey(iAuthLoop)) then response.write("selected")%>><%=aAuthItem(iAuthLoop)%></option>
  234. <%
  235. next
  236. %>
  237. </select>
  238. <label><%=rs_post("memo")%></label>
  239. </div>
  240. <%
  241. rs_post.movenext
  242. loop
  243. rs_post.close
  244. set rs_post=nothing
  245. %>
  246. </div>
  247. </div>
  248. </div>
  249. <div class="type-button">
  250. <%if id="" then%>
  251. <input type="submit" name="submit" value="??" />
  252. <%end if%>
  253. <%if id<>"" and (id<>1 or session("sUserName")="admin") then%>
  254. <input type="submit" name="submit" value="??" />
  255. <%end if%>
  256. </div>
  257. </form>
  258. <table id="tablelist" class="full">
  259. <thead>
  260. <tr><th colspan="7" scope="col">????</th></tr>
  261. </thead>
  262. <tbody>
  263. <tr>
  264. <th scope="col">???</th>
  265. <th scope="col">??</th>
  266. <th scope="col">?????</th>
  267. <th scope="col">??</th>
  268. <th scope="col">????</th>
  269. <th scope="col">????</th>
  270. <th scope="col">??</th>
  271. </tr>
  272. <%
  273. sql = "select username.*,wtr.wtr as wtrname from username left join wtr on username.wtr=wtr.id order by wtr.id,username.username"
  274. Set rs = Server.CreateObject("ADODB.Recordset")
  275. rs.Open sql,conn,1,1
  276. do while not rs.eof
  277. %>
  278. <tr>
  279. <th class="sub" scope="row"><a href="username.asp?id=<%=rs("id")%>"><%=rs("username")%></a></th>
  280. <td><%=rs("fullname")%></td>
  281. <td><%=rs("wtrname")%></td>
  282. <td><%if rs("active") then response.write("??")%></td>
  283. <td><%if rs("wan") then response.write("?")%></td>
  284. <td><%if rs("employee") then response.write("?")%></td>
  285. <td>
  286. <%
  287. Set rs_flag = Server.CreateObject("ADODB.Recordset")
  288. sql_flag="SELECT post.post,flag from flag inner join post on flag.post=post.id where username="&rs("id")
  289. rs_flag.Open sql_flag,conn,1,1
  290. do while not rs_flag.eof
  291. response.write(FillSpace(rs_flag("post"),12)&"?"&dAuthority(cstr(rs_flag("flag")))&"<br />")
  292. rs_flag.movenext
  293. loop
  294. rs_flag.close
  295. set rs_flag=nothing
  296. %>
  297. </td>
  298. </tr>
  299. <%
  300. rs.movenext
  301. loop
  302. rs.close
  303. set rs=nothing
  304. %>
  305. </tbody>
  306. </table>
  307. </div>
  308. </div>
  309. </div>
  310. <!--#include file="lib/footer.asp"-->
  311. </body>
  312. </html>
  313. <!--#include file="lib/connclose.asp"-->