PageRenderTime 59ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/username.asp

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